diff --git a/app/controller/api/Auth.php b/app/controller/api/Auth.php index 5a329951..59aef1e3 100644 --- a/app/controller/api/Auth.php +++ b/app/controller/api/Auth.php @@ -980,4 +980,35 @@ class Auth extends BaseController + + //获取app版本更新信息 + public function appVersion() + { + $type = $this->request->param('type', '-1'); + // $version = $this->request->param('version', ''); + // $phoneBrand = $this->request->param('phone_brand', ''); + // $queryBuilder = Db::name('AppUpdate')->where('type', $type); + if ($type == 3) { + $android = (Db::name('AppUpdate')->where('type', 1)->where('phone_brand', '')->where('is_wget',0)->order('id', 'desc')->find()) ?? (object)[]; + $ios = (Db::name('AppUpdate')->where('type', 2)->where('phone_brand', '')->order('id', 'desc')->find()) ?? (object)[]; + return app('json')->success(compact('android', 'ios')); + } else { + $agent = strtolower($this->request->server('HTTP_USER_AGENT')); + // 检查是否为iOS设备,包括iPhone和iPad + if (strpos($agent, 'iphone') !== false || strpos($agent, 'ipad') !== false) { + $appInfo=[]; + } elseif (strpos($agent, 'android') !== false) { + // 检查是否为Android设备 + $appInfo = Db::name('AppUpdate')->where('type', $type)->order('id','desc')->find(); + } else { + $appInfo=[]; + // 如果都不是,则输出其他 + } + } + + return app('json')->success(compact('appInfo')); + } + + + } diff --git a/route/api.php b/route/api.php index c1e40416..9426eb65 100644 --- a/route/api.php +++ b/route/api.php @@ -28,6 +28,7 @@ Route::group('api/', function () { Route::get('business/agree', 'api.Auth/businessAgree'); Route::any('system_group_value', 'api.Common/system_group_value'); Route::get('category/list_level', 'api.server.StoreCategory/list_level'); + Route::any('app/version', 'api.Auth/appVersion'); //强制登录 Route::group(function () {