Explorar el Código

fix(api): 修复安卓版本比较逻辑

- 使用数值比较替代字符串比较来判断版本更新
- 添加版本号格式化处理以确保正确比较
- 修复了版本号比较的逻辑错误
shichen hace 7 meses
padre
commit
6b7e630a9e
Se han modificado 1 ficheros con 6 adiciones y 2 borrados
  1. 6 2
      app/controller/api/Common.php

+ 6 - 2
app/controller/api/Common.php

@@ -393,9 +393,13 @@ class Common extends BaseController
393
         //安卓
393
         //安卓
394
         if ($data['type'] == 1) {
394
         if ($data['type'] == 1) {
395
             $config = systemConfig(['about_edition_android', 'about_link_android', 'update_content','Android_forced_update']);
395
             $config = systemConfig(['about_edition_android', 'about_link_android', 'update_content','Android_forced_update']);
396
-            if ($data['about'] != $config['about_edition_android']) {
396
+
397
+            $version = str_replace('.', '', $data['about']);
398
+            $sysVersion = str_replace('.', '', $config['about_edition_android']);
399
+
400
+            if ($version < $sysVersion) {
397
                 return app('json')->success($config);
401
                 return app('json')->success($config);
398
-            } else {
402
+            }else{
399
                 return app('json')->fail('已是最新版本');
403
                 return app('json')->fail('已是最新版本');
400
             }
404
             }
401
         }
405
         }