catalog/model/extension/module/wechatofficial_login.php

(完整代码) 1KB

<?php

/**
 * ModelModuleWeiboLogin
 *
 * @copyright  2016 damicms.com - All Rights Reserved
 * @link       http://www.guangdawangluo.com
 * @author     Edward Yang <yangjin@damicms.com>
 * @created    2016-11-18 16:00
 * @modified   2016-11-18 16:00
 */

class ModelExtensionModuleWechatofficialLogin extends ModelExtensionModuleSocial
{
    public function handleWeChat($unionId, $uid, $accessToken)
    {
        if ($unionId) {
            $customer = $this->getCustomerByUnionId($unionId, 'wechatofficial');
            if ($customer) {
                return $customer;
            }
            $customer = $this->getCustomerByUnionId($unionId);
            if ($customer) {
                $authData = array(
                    'customer_id' => $customer['customer_id'],
                    'uid' => $uid,
                    'unionid' => $unionId,
                    'provider' => 'wechatofficial',
                    'avatar' => '',
                    'access_token' => $accessToken,
                    'date_added' => date('Y-m-d H:i:s'),
                    'date_modified' => date('Y-m-d H:i:s')
                );
                $this->createAuthentication($authData);
                return $customer;
            }
        } elseif ($uid) {
            $customer = $this->getCustomerByUid($uid, 'wechatofficial');
            return $customer;
        }
        return array();
    }
}

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。