Commit b2695e8f authored by hujun's avatar hujun

后台登录生成AuthToken

parent 7863a061
......@@ -2,6 +2,7 @@
namespace app\index\controller;
use app\api\untils\JwtUntils;
use app\index\extend\Basic;
use app\model\AAgents;
use app\model\AuthRule;
......@@ -105,11 +106,19 @@ class Login extends Basic
$list = $list->toArray();//转化arr
}
$jwt = new JwtUntils();
$jwt_data['id'] = $list['id'];
$jwt_data['name'] = $list['name'];
$jwt_data['phone'] = $list['phone'];
$jwt_data['level'] = $list['level'];
$list['AuthToken'] = $jwt->createToken($jwt_data);
Session::set("userName",$list["name"]);
Session::set("userId",$list["id"]);
Session::set("lastLoginTime",time());
Session::set("user_info",$list);
$this->operating_records($list["id"],1,'后台登陆'); //记录操作日志
if($this->request->isAjax()) {
return $this->response('200', '登录成功', $list);
}else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment