正在显示
1 个修改的文件
包含
7 行增加
和
0 行删除
| @@ -45,6 +45,11 @@ class Login extends Base | @@ -45,6 +45,11 @@ class Login extends Base | ||
| 45 | //查询到openid 通过openid查询到用户 | 45 | //查询到openid 通过openid查询到用户 |
| 46 | $user=Db::name("user")->where('wx_xcx_openid',$res['openid'])->find(); | 46 | $user=Db::name("user")->where('wx_xcx_openid',$res['openid'])->find(); |
| 47 | if($user){ | 47 | if($user){ |
| 48 | + if(!$user['unionid']){ | ||
| 49 | + $user=Db::name("user") | ||
| 50 | + ->where('wx_xcx_openid',$res['openid']) | ||
| 51 | + ->update(['unionid'=>$res['unionid']]); | ||
| 52 | + } | ||
| 48 | $res=$this->auth->direct($user['id']); | 53 | $res=$this->auth->direct($user['id']); |
| 49 | $return_data = $this->auth->getUserinfo(); | 54 | $return_data = $this->auth->getUserinfo(); |
| 50 | 55 | ||
| @@ -63,6 +68,8 @@ class Login extends Base | @@ -63,6 +68,8 @@ class Login extends Base | ||
| 63 | $extend_data = [ | 68 | $extend_data = [ |
| 64 | "avatar" => "/default.png", | 69 | "avatar" => "/default.png", |
| 65 | "wx_xcx_openid" => $res['openid'], | 70 | "wx_xcx_openid" => $res['openid'], |
| 71 | + 'unionid'=>$res['unionid'], | ||
| 72 | + "wx_xcx_openid" => $res['openid'], | ||
| 66 | ]; | 73 | ]; |
| 67 | $ret = $this->auth->register($username, "a123456", '','', $extend_data); | 74 | $ret = $this->auth->register($username, "a123456", '','', $extend_data); |
| 68 | if($ret){ | 75 | if($ret){ |
-
请 注册 或 登录 后发表评论