处理版本接口

This commit is contained in:
liu 2024-03-18 09:50:03 +08:00
parent 3be0a42dc4
commit c872994d00
2 changed files with 32 additions and 0 deletions

View File

@ -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'));
}
} }

View File

@ -28,6 +28,7 @@ Route::group('api/', function () {
Route::get('business/agree', 'api.Auth/businessAgree'); Route::get('business/agree', 'api.Auth/businessAgree');
Route::any('system_group_value', 'api.Common/system_group_value'); Route::any('system_group_value', 'api.Common/system_group_value');
Route::get('category/list_level', 'api.server.StoreCategory/list_level'); Route::get('category/list_level', 'api.server.StoreCategory/list_level');
Route::any('app/version', 'api.Auth/appVersion');
//强制登录 //强制登录
Route::group(function () { Route::group(function () {