UserApi::unbind PHP Method

unbind() public method

解绑第三方帐号 --using
public unbind ( ) : 状态+提示
return 状态+提示
    public function unbind()
    {
        $type = t($this->data['type']);
        if ($type == 'phone') {
            // $uname = model ( 'User' )->where ( 'uid=' . $this->mid )->getField ( 'uname' );
            $res = model('User')->where('uid=' . $this->mid)->setField('phone', '');
            if ($res !== false) {
                model('User')->cleanCache($this->mid);
                return array('status' => 1, 'msg' => '解绑成功');
            } else {
                return array('status' => 0, 'msg' => '解绑失败');
            }
        } else {
            if (D('login')->where("uid={$this->mid} AND type='{$type}'")->delete()) {
                S('user_login_' . $this->mid, null);
                return array('status' => 1, 'msg' => '解绑成功');
            } else {
                return array('status' => 0, 'msg' => '解绑失败');
            }
        }
    }