diff --git a/README.md b/README.md index 9c79c60..f7933d8 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ [![ApiAdmin](https://img.shields.io/badge/ApiAdmin-5.0.0-brightgreen.svg)](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) ## 快速安装 diff --git a/app/controller/admin/ThirdLogin.php b/app/controller/admin/ThirdLogin.php index 283a713..dd66bf7 100644 --- a/app/controller/admin/ThirdLogin.php +++ b/app/controller/admin/ThirdLogin.php @@ -298,8 +298,8 @@ class ThirdLogin extends Base { * @throws \think\db\exception\ModelNotFoundException * @author zhaoxiang */ - 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'));