UserApi::bind_other PHP Method

bind_other() public method

第三方帐号绑定 --using
public bind_other ( ) : array
return array 状态+提示
    public function bind_other()
    {
        $type = addslashes($this->data['type']);
        $type_uid = addslashes($this->data['type_uid']);
        $access_token = addslashes($this->data['access_token']);
        $refresh_token = addslashes($this->data['refresh_token']);
        $expire = intval($this->data['expire_in']);
        if (!empty($type) && !empty($type_uid)) {
            $syncdata['uid'] = $this->mid;
            $syncdata['type_uid'] = $type_uid;
            $syncdata['type'] = $type;
            $syncdata['oauth_token'] = $access_token;
            $syncdata['oauth_token_secret'] = $refresh_token;
            $syncdata['is_sync'] = 0;
            S('user_login_' . $this->mid, null);
            if ($info = M('login')->where("type_uid={$type_uid} AND type='" . $type . "'")->find()) {
                return array('status' => 0, 'msg' => '该帐号已绑定');
            } else {
                if (M('login')->add($syncdata)) {
                    return array('status' => 1, 'msg' => '绑定成功');
                }
            }
        } else {
            return array('status' => 0, 'msg' => '参数错误');
        }
    }