From a3b3bd04ef684ee93a6f9dc7d09a2ab5944a9901 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E5=8D=8E=E6=B8=85?= <18691022700@163.com> Date: Tue, 12 Aug 2025 14:05:47 +0800 Subject: [PATCH] =?UTF-8?q?=E7=99=BB=E5=BD=95=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/common/controller/BaseCom.php | 29 ++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/application/common/controller/BaseCom.php b/application/common/controller/BaseCom.php index b4279c3..f588969 100644 --- a/application/common/controller/BaseCom.php +++ b/application/common/controller/BaseCom.php @@ -36,10 +36,33 @@ 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); + 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)) {