登录处理

This commit is contained in:
2025-08-12 11:16:48 +08:00
parent 06c5df0207
commit f9d9a1bf5c
2 changed files with 5 additions and 6 deletions

View File

@@ -10,14 +10,14 @@ class UserToken extends Model
public function check_login_token($token) public function check_login_token($token)
{ {
if (empty($token)) { if (empty($token)) {
return ['code' => 301, 'msg' => '登录失效', 'data' =>null]; return ['code' => 301, 'msg' => '登录失效!', 'data' =>null];
} }
$user_token = $this->where('token', $token)->find(); $user_token = $this->where('token', $token)->find();
if (empty($user_token)) { if (empty($user_token)) {
return ['code' => 301, 'msg' => '登录失效', 'data' => null]; return ['code' => 301, 'msg' => '登录失效!!', 'data' => null];
} }
if ($user_token['expiretime'] < time()) { if ($user_token['expiretime'] < time()) {
return ['code' => 301, 'msg'=> '登录失效', 'data' => null]; return ['code' => 301, 'msg'=> '登录失效!!!', 'data' => null];
} }
$block1 = db::name('block')->where(['type' => 1,'type_text' => $user_token['user_id']])->find(); $block1 = db::name('block')->where(['type' => 1,'type_text' => $user_token['user_id']])->find();

View File

@@ -20,7 +20,6 @@ class BaseCom extends Controller
header("Access-Control-Max-Age: 3600"); header("Access-Control-Max-Age: 3600");
//检测系统是否维护中 //检测系统是否维护中
// $config = get_system_config();
$is_maintenance = get_system_config_value('is_maintenance'); $is_maintenance = get_system_config_value('is_maintenance');
if($is_maintenance == 2){ if($is_maintenance == 2){
return V(203, '系统维护中'); return V(203, '系统维护中');
@@ -42,9 +41,9 @@ class BaseCom extends Controller
//定义一个常量 //定义一个常量
define('UID', $this->uid); define('UID', $this->uid);
}else{ }else{
$token = input('token', '');
if (empty($token)) {
$token = request()->header('token'); $token = request()->header('token');
if (empty($token)) {
$token = input('token', '');
if(empty($token)){ if(empty($token)){
return V(301, '登录失效'); return V(301, '登录失效');
} }