...
|
...
|
@@ -36,7 +36,6 @@ class Login extends Base |
|
|
$result = http_request($url);
|
|
|
//file_put_contents("111111111111222.txt","3-1. ".($result)."\r\n",FILE_APPEND);
|
|
|
$res = json_decode($result, true);
|
|
|
print_r($res);return;
|
|
|
|
|
|
if (!$res) {
|
|
|
$this->error("授权失败,请尝试重新授权");
|
...
|
...
|
@@ -45,6 +44,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 +67,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){
|
...
|
...
|
|