mirror of
https://gitee.com/apiadmin/ApiAdmin.git
synced 2025-04-05 19:41:43 +08:00
modified 完善三方账号登录
This commit is contained in:
parent
dd62e2cdd1
commit
692baef59e
@ -8,7 +8,7 @@
|
||||
[](http://www.apiadmin.org/)
|
||||
|
||||
## 前端页面
|
||||
ApiAdmin4.1是一个前后端完全分离的项目,前端采用Vue构建,如需要可视化配置的请移步:[ApiAdmin-WEB](https://gitee.com/apiadmin/ApiAdmin-WEB)
|
||||
ApiAdmin5.0是一个前后端完全分离的项目,前端采用Vue构建,如需要可视化配置的请移步:[ApiAdmin-WEB](https://gitee.com/apiadmin/ApiAdmin-WEB)
|
||||
|
||||
## 快速安装
|
||||
|
||||
|
@ -298,8 +298,8 @@ class ThirdLogin extends Base {
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author zhaoxiang <zhaoxiang051405@gmail.com>
|
||||
*/
|
||||
private function doLogin($openid, $userDetail): Response {
|
||||
$userInfo = AdminUser::get(['openid' => $openid]);
|
||||
private function doLogin(string $openid, array $userDetail): Response {
|
||||
$userInfo = (new AdminUser())->where('openid', $openid)->find();
|
||||
if (empty($userInfo)) {
|
||||
$userInfo = AdminUser::create([
|
||||
'nickname' => $userDetail['nickname'],
|
||||
@ -313,7 +313,7 @@ class ThirdLogin extends Base {
|
||||
$userDataArr = [
|
||||
'login_times' => 1,
|
||||
'uid' => $userInfo->id,
|
||||
'last_login_ip' => $this->request->ip(1),
|
||||
'last_login_ip' => sprintf("%u", ip2long($this->request->ip())),
|
||||
'last_login_time' => time(),
|
||||
'head_img' => $userDetail['head_img']
|
||||
];
|
||||
@ -328,7 +328,7 @@ class ThirdLogin extends Base {
|
||||
if ($userInfo['status']) {
|
||||
//更新用户数据
|
||||
$userInfo->userData->login_times++;
|
||||
$userInfo->userData->last_login_ip = $this->request->ip(1);
|
||||
$userInfo->userData->last_login_ip = sprintf("%u", ip2long($this->request->ip()));
|
||||
$userInfo->userData->last_login_time = time();
|
||||
$userInfo->userData->save();
|
||||
} else {
|
||||
@ -336,8 +336,8 @@ class ThirdLogin extends Base {
|
||||
}
|
||||
}
|
||||
|
||||
$userInfo['access'] = (new Login())->getAccess($userInfo['id']);
|
||||
$userInfo['menu'] = (new Login())->getAccessMenu($userInfo['id']);
|
||||
$userInfo['access'] = (new Login(App()))->getAccess($userInfo['id']);
|
||||
$userInfo['menu'] = (new Login(App()))->getAccessMenuData($userInfo['id']);
|
||||
|
||||
$apiAuth = md5(uniqid() . time());
|
||||
cache('Login:' . $apiAuth, json_encode($userInfo), config('apiadmin.ONLINE_TIME'));
|
||||
|
Loading…
x
Reference in New Issue
Block a user