diff --git a/app/controller/api/Auth.php b/app/controller/api/Auth.php index 0f2ba7f4..9c5faf97 100644 --- a/app/controller/api/Auth.php +++ b/app/controller/api/Auth.php @@ -1310,9 +1310,17 @@ class Auth extends BaseController //获取app版本更新信息 public function appVersion() { + $type = $this->request->param('type', '-1'); $version = $this->request->param('version', ''); - $type = $this->request->param('type', '1'); - $appInfo = (Db::name('AppUpdate')->where('type', $type)->where('version', '>', $version)->order('id', 'desc')->find()) ?? (object)[]; + $phoneBrand = $this->request->param('phone_brand', ''); + $queryBuilder = Db::name('AppUpdate')->where('type', $type); + if ($version) { + $queryBuilder = $queryBuilder->where('version', '>', $version); + } + if ($phoneBrand) { + $queryBuilder = $queryBuilder->where('phone_brand', $phoneBrand); + } + $appInfo = ($queryBuilder->order('id', 'desc')->find()) ?? (object)[]; return app('json')->success(compact('appInfo')); } }