作者 黄超

123

... ... @@ -45,6 +45,11 @@ class Login extends Base
//查询到openid 通过openid查询到用户
$user=Db::name("user")->where('wx_xcx_openid',$res['openid'])->find();
if($user){
if(!$user['unionid']){
$user=Db::name("user")
->where('wx_xcx_openid',$res['openid'])
->update(['unionid'=>$res['unionid']]);
}
$res=$this->auth->direct($user['id']);
$return_data = $this->auth->getUserinfo();
... ... @@ -63,6 +68,8 @@ class Login extends Base
$extend_data = [
"avatar" => "/default.png",
"wx_xcx_openid" => $res['openid'],
'unionid'=>$res['unionid'],
"wx_xcx_openid" => $res['openid'],
];
$ret = $this->auth->register($username, "a123456", '','', $extend_data);
if($ret){
... ...