mirror of
https://gitee.com/apiadmin/ApiAdmin.git
synced 2025-04-06 03:58:00 +08:00
modified 登录账号增加用户组数据返回
This commit is contained in:
parent
4cf658625f
commit
cae75e3e4c
@ -8,6 +8,7 @@
|
|||||||
namespace app\admin\controller;
|
namespace app\admin\controller;
|
||||||
|
|
||||||
|
|
||||||
|
use app\model\ApiAuthGroupAccess;
|
||||||
use app\model\ApiUser;
|
use app\model\ApiUser;
|
||||||
use app\model\ApiUserData;
|
use app\model\ApiUserData;
|
||||||
use app\util\ReturnCode;
|
use app\util\ReturnCode;
|
||||||
@ -17,9 +18,10 @@ class Login extends Base {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户登录
|
* 用户登录
|
||||||
* @author zhaoxiang <zhaoxiang051405@gmail.com>
|
|
||||||
* @return array
|
* @return array
|
||||||
|
* @throws \think\Exception
|
||||||
* @throws \think\exception\DbException
|
* @throws \think\exception\DbException
|
||||||
|
* @author zhaoxiang <zhaoxiang051405@gmail.com>
|
||||||
*/
|
*/
|
||||||
public function index() {
|
public function index() {
|
||||||
$username = $this->request->post('username');
|
$username = $this->request->post('username');
|
||||||
@ -59,6 +61,17 @@ class Login extends Base {
|
|||||||
$userToken = md5(uniqid() . time());
|
$userToken = md5(uniqid() . time());
|
||||||
cache($userToken, json_encode($userInfo), config('apiAdmin.ONLINE_TIME'));
|
cache($userToken, json_encode($userInfo), config('apiAdmin.ONLINE_TIME'));
|
||||||
cache($userInfo['id'], $userToken, config('apiAdmin.ONLINE_TIME'));
|
cache($userInfo['id'], $userToken, config('apiAdmin.ONLINE_TIME'));
|
||||||
|
|
||||||
|
$groups = ApiAuthGroupAccess::get(['uid' => $userInfo['id']]);
|
||||||
|
$return['access'] = 0;
|
||||||
|
if (isset($groups) || $groups->groupId) {
|
||||||
|
if (strpos($groups->groupId, ',') === false) {
|
||||||
|
$return['access'] = intval($groups->groupId);
|
||||||
|
} else {
|
||||||
|
$return['access'] = explode(',', $groups->groupId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$return['id'] = $userInfo['id'];
|
$return['id'] = $userInfo['id'];
|
||||||
$return['username'] = $userInfo['username'];
|
$return['username'] = $userInfo['username'];
|
||||||
$return['nickname'] = $userInfo['nickname'];
|
$return['nickname'] = $userInfo['nickname'];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user