likang 2 年之前
父節點
當前提交
521add133f
共有 2 個文件被更改,包括 28 次插入2 次删除
  1. 24 1
      catch/api/controller/Api.php
  2. 4 1
      catch/api/route.php

+ 24 - 1
catch/api/controller/Api.php

@@ -5,7 +5,7 @@
  * @Author: likang
  * @Date: 2022-08-12 10:33:24
  * @LastEditors: likang 1186820806@qq.com
- * @LastEditTime: 2022-11-18 15:48:31
+ * @LastEditTime: 2023-02-20 13:49:38
  */
 
 
@@ -72,7 +72,30 @@ class Api extends CatchController
             sleep(60*60*24);
         }
     
+    }
+
+    /**
+     * 检测小程序版本版本 function
+     *
+     * @return void
+     */
+    public function detectionVersion(){
+        $token = $_GET['token'];
+        if (!$token || $token != '444333d3') {
+            json_fail('缺少token或者token不对');
+        }
+        $param = json_decode(optimize_json(file_get_contents("php://input")), true);
+        if (json_last_error() != 0) {
+            json_fail('解析异常', json_last_error_msg());
+        }
 
+       if($param["version"]=="1.1.1"){
+            json_success("版本一致");
+       }else{
+        //当前更新的版本地址
+        $data["url"]="";
+        json_fail("版本需要更新",$data);
+       }
     }
 
 

+ 4 - 1
catch/api/route.php

@@ -5,7 +5,7 @@
  * @Author: likang
  * @Date: 2022-06-09 10:11:32
  * @LastEditors: likang 1186820806@qq.com
- * @LastEditTime: 2022-11-18 15:49:26
+ * @LastEditTime: 2023-02-20 14:32:15
  */
 // +----------------------------------------------------------------------
 // | CatchAdmin [Just Like ~ ]
@@ -26,3 +26,6 @@ $router->group(function () use ($router) {
 //报警上传
 $router->post('api/report', '\catchAdmin\api\controller\Api@report');
 $router->get('api/deleteHistory', '\catchAdmin\api\controller\Api@deleteHistory');
+//更新软件版本测试
+$router->get('api/detectionVersion', '\catchAdmin\api\controller\Api@detectionVersion');
+