master
wangxinglong 2021-12-16 11:18:14 +08:00
parent b901dd9e95
commit 1ede9fad50
1 changed files with 18 additions and 4 deletions

View File

@ -100,6 +100,10 @@ class User extends Base
} else {
$updateData = [
'login_time' => $nowDate,
'lat' => empty($account->lat)?$params['lat'] :$account->lat,//如果之前的位置信息是空的
'lng' => empty($account->lng)?$params['lng'] :$account->lng,//如果之前的位置信息是空的
'mobile' => (!is_mobile($account->mobile))?$params['mobile']:$account->mobile,//如果之前的电话信息是空的
'real_name' => empty($account->real_name)?$params['real_name']:$account->real_name,//如果之前的电话信息是空的
];
// 更新资料
@ -258,15 +262,25 @@ class User extends Base
. $code
. '&grant_type=authorization_code';
$data = json_decode(Tool::httpRequest($url, "get"), true);
//返回状态
if (isset($data["openid"])) {
$account = AccountRepository::getInstance()->findByOpenID($data["openid"]);
if(empty($account)){
return $this->json(0, "fail",["isNewAccount"=>true,"session_key"=>$data["session_key"]]);
return $this->json(0, "success",[
"showMobile"=>true,
"showRealName"=>true,
"session_key"=>$data["session_key"]]);
}
return $this->json(0, "fail",["isNewAccount"=>false,"session_key"=>$data["session_key"]]);
return $this->json(0, "success",[
"showMobile"=>is_mobile($account->mobile)?false:true,
"showRealName"=>(!empty($account->real_name))?false:true,
"session_key"=>$data["session_key"]
]);
}
return $this->json(0, "fail",["isNewAccount"=>true]);
return $this->json(5001, "获取登录状态失败", ["showMobile"=>true,
"showRealName"=>true,
"session_key"=>'']);
}
/**