Merge remote-tracking branch 'origin/develop' into develop
This commit is contained in:
@@ -10,14 +10,14 @@ class UserToken extends Model
|
||||
public function check_login_token($token)
|
||||
{
|
||||
if (empty($token)) {
|
||||
return ['code' => 301, 'msg' => '登录失效', 'data' =>null];
|
||||
return ['code' => 301, 'msg' => '登录失效!', 'data' =>null];
|
||||
}
|
||||
$user_token = $this->where('token', $token)->find();
|
||||
if (empty($user_token)) {
|
||||
return ['code' => 301, 'msg' => '登录失效', 'data' => null];
|
||||
return ['code' => 301, 'msg' => '登录失效!!', 'data' => null];
|
||||
}
|
||||
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();
|
||||
|
||||
@@ -20,7 +20,6 @@ class BaseCom extends Controller
|
||||
header("Access-Control-Max-Age: 3600");
|
||||
|
||||
//检测系统是否维护中
|
||||
// $config = get_system_config();
|
||||
$is_maintenance = get_system_config_value('is_maintenance');
|
||||
if($is_maintenance == 2){
|
||||
return V(203, '系统维护中');
|
||||
@@ -37,14 +36,37 @@ class BaseCom extends Controller
|
||||
}
|
||||
$zhenshi_version = db::name('version')->where('type', 2)->value('oldversion');
|
||||
$result = version_compare($version,$zhenshi_version);
|
||||
//请求的接口
|
||||
$api = request()->controller().'/'.request()->action();
|
||||
if($system == 'iOS' && $result > 0){
|
||||
$this->uid = 0;
|
||||
//定义一个常量
|
||||
define('UID', $this->uid);
|
||||
}else{
|
||||
$token = input('token', '');
|
||||
if (empty($token)) {
|
||||
if($api == 'Index/index_banner' || $api == 'Index/room_type_list' || $api == 'Index/room_list' || $api == 'UserZone/expand_zone' || $api == 'UserZone/zone_list' || $api == 'UserZone/topic_list' || $api == 'UserZone/get_zone_topic'){
|
||||
$this->uid = 0;
|
||||
//定义一个常量
|
||||
define('UID', $this->uid);
|
||||
}else{
|
||||
$token = request()->header('token');
|
||||
if (empty($token)) {
|
||||
$token = input('token', '');
|
||||
if(empty($token)){
|
||||
return V(301, '登录失效');
|
||||
}
|
||||
}
|
||||
|
||||
$reslut = model('UserToken')->check_login_token($token);
|
||||
if($reslut['code'] != 1) {
|
||||
model('UserToken')->where('token', $token)->update(['token' => 1]);
|
||||
return V($reslut['code'], $reslut['msg'],$reslut['data']);
|
||||
} else {
|
||||
$this->uid = $reslut['data'];
|
||||
//定义一个常量
|
||||
define('UID', $this->uid);
|
||||
}
|
||||
}
|
||||
|
||||
}else{
|
||||
$token = request()->header('token');
|
||||
if (empty($token)) {
|
||||
$token = input('token', '');
|
||||
if(empty($token)){
|
||||
return V(301, '登录失效');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user