Browse Source

fix:合并链接逻辑修复

luoy 2 days ago
parent
commit
752f455cf6
3 changed files with 28 additions and 1 deletions
  1. 1 0
      index.php
  2. 27 0
      source/index/app.php
  3. 0 1
      source/index/combine.php

+ 1 - 0
index.php

@@ -4,6 +4,7 @@
 PHP_VERSION < "7.1" && exit("需要 PHP >= 7.1 , 当前版本 : " . PHP_VERSION);
 include_once "source/system/db.class.php";
 $read = "app/" . $info . "/" . $module;
+
 if (findClassFile($read)) {
 	loadClass($info, $module, $action);
 } else {

+ 27 - 0
source/index/app.php

@@ -5,8 +5,35 @@ class app extends Base
 {
     protected $template_note;
 
+    function getMobileType() {
+        $userAgent = $_SERVER['HTTP_USER_AGENT'];
+        
+        // 检查iOS设备
+        if (dstrpos($userAgent, ['iphone', 'ipad', 'ipod', 'ios'])) {
+            return 'ios';
+        }
+        
+        // 检查Android设备
+        if (dstrpos($userAgent, ['android'])) {
+            return 'android';
+        }
+        
+        return 'unknown';
+    }
+
     function index($info = '', $module = '')
     {
+        
+
+        $uri = trim($_SERVER['REQUEST_URI'], '/');
+        if($uri){
+            $check = db("combine")->where('short', $uri)->find();
+            // print_r($check);die;
+            if(!empty($check)){
+                $system = $this->getMobileType();
+                header("Location: ".$check[$system]);
+            }
+        }
         $ssid = SafeRequest('ssid', 'get');
         $authcode = SafeRequest('authcode', 'get');
         $authcode && setcookie('downcode', $authcode);

+ 0 - 1
source/index/combine.php

@@ -813,7 +813,6 @@ class combine extends BaseUser
             echo json_encode($response);
             exit;
         }
-        
         if ($_var_7) {
             // 使用新的返回格式
             $response = [