Update Login.php

This commit is contained in:
Anyon 2019-04-04 13:37:04 +08:00
parent 609834edd4
commit 6fe1fda5ef

View File

@ -54,6 +54,11 @@ class Login extends BasicAdmin
/** /**
* 用户登录 * 用户登录
* @return string * @return string
* @throws \think\Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @throws \think\exception\PDOException
*/ */
public function index() public function index()
{ {
@ -71,7 +76,7 @@ class Login extends BasicAdmin
($user['password'] !== md5($password)) && $this->error('登录密码与账号不匹配,请重新输入!'); ($user['password'] !== md5($password)) && $this->error('登录密码与账号不匹配,请重新输入!');
empty($user['status']) && $this->error('账号已经被禁用,请联系管理!'); empty($user['status']) && $this->error('账号已经被禁用,请联系管理!');
// 更新登录信息 // 更新登录信息
$data = ['login_at' => ['exp', 'now()'], 'login_num' => ['exp', 'login_num+1']]; $data = ['login_at' => date('Y-m-d H:i:s'), 'login_num' => $user['login_num'] + 1];
Db::name('SystemUser')->where('id', $user['id'])->update($data); Db::name('SystemUser')->where('id', $user['id'])->update($data);
session('user', $user); session('user', $user);
!empty($user['authorize']) && NodeService::applyAuthNode(); !empty($user['authorize']) && NodeService::applyAuthNode();