header('system'); } //版本号 $version = input('App-Version',''); if(empty($version)){ $version = request()->header('App-Version'); } $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){ 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); //检测ID是否在内测中 $inside_uid 是逗号分隔的ID $is_maintenance ==3 是内测 if($inside_uid && $is_maintenance == 3){ //先转为数组 不是内侧账号 返回301 $inside_uid = explode(',',$inside_uid); if(!in_array($this->uid,$inside_uid)){ return V(0, '系统维护中'); } }elseif($is_maintenance == 2){ return V(0, '系统维护中'); } } } }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); //检测ID是否在内测中 $inside_uid 是逗号分隔的ID $is_maintenance ==3 是内测 if($inside_uid && $is_maintenance == 3){ //先转为数组 不是内侧账号 返回301 $inside_uid = explode(',',$inside_uid); if(!in_array($this->uid,$inside_uid)){ return V(0, '系统维护中'); } }elseif($is_maintenance == 2){ return V(0, '系统维护中'); } } } } }