|
|
@@ -53,13 +53,15 @@ class LoginMiddleware
|
|
|
//token过期无效并且该地址需要登录才能访问
|
|
|
return JsonService::fail('登录超时,请重新登录', [], -1);
|
|
|
}
|
|
|
-
|
|
|
+ $controller = $request->controller();
|
|
|
+ $is_kefu = 0;
|
|
|
//token临近过期,自动续期
|
|
|
if ($adminInfo) {
|
|
|
//客服派单员
|
|
|
if (isset($adminInfo['role_name']) && (strpos($adminInfo['role_name'], '派单') !== false || strpos($adminInfo['role_name'], '客服') !== false)) {
|
|
|
//获取临近过期自动续期时长
|
|
|
$beExpireDuration = Config::get('project.kefu_admin_token.be_expire_duration');
|
|
|
+ $is_kefu = 1;
|
|
|
} else {
|
|
|
//获取临近过期自动续期时长
|
|
|
$beExpireDuration = Config::get('project.admin_token.be_expire_duration');
|
|
|
@@ -67,10 +69,14 @@ class LoginMiddleware
|
|
|
|
|
|
//token续期
|
|
|
if (time() > ($adminInfo['expire_time'] - $beExpireDuration)) {
|
|
|
- $result = AdminTokenService::overtimeToken($token);
|
|
|
- //续期失败(数据表被删除导致)
|
|
|
- if (empty($result)) {
|
|
|
- return JsonService::fail('登录过期', [], -1);
|
|
|
+ if ($is_kefu == 1 && $controller == 'notice.Notice') {
|
|
|
+
|
|
|
+ } else {
|
|
|
+ $result = AdminTokenService::overtimeToken($token);
|
|
|
+ //续期失败(数据表被删除导致)
|
|
|
+ if (empty($result)) {
|
|
|
+ return JsonService::fail('登录过期', [], -1);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|