Browse Source

Merge branch 'master' of https://git.97admin.com:433/chendeben/taoqu

chendeben 6 years ago
parent
commit
41aa411d43
1 changed files with 19 additions and 33 deletions
  1. 19 33
      App/Api/Model/Dataoke.php

+ 19 - 33
App/Api/Model/Dataoke.php

@@ -25,44 +25,30 @@ class Dataoke
             $query = parse_url($url);
 
             $t = parse_query($query['query']);
-            if ($t['kw']) {
-                $q = [];
-                if ($t['cid']) {
-                    $q['cid'] = $t['cid'];
-                }
-                if ($t['pid']) {
-                    $q['pid'] = $t['pid'];
-                }
-                if ($t['bids']) {
-                    $q['bids'] = $t['bids'];
-                }
+            $q = [];
+            if ($t['cid']) {
+                $q['cid'] = $t['cid'];
+            }
+            if ($t['pid']) {
+                $q['pid'] = $t['pid'];
+            }
+            if ($t['bids']) {
+                $q['bids'] = $t['bids'];
+            }
+            if ($t['original_id']){
+                $q['original_id'] = $t['original_id'];
+            }
 
-                //elseif ($t['cid']){
-//                    $new_url="/kw/" . $t['kw'] . ".html?cid=".$t['cid'];
-//                } else{
-//                    $d=$t;
-//                    unset($d['kw']);
-//                }
-                if (count($q) > 0) {
-                    $s = "?" . http_build_query($q);
-                } else {
-                    $s = "";
-                }
+            if (count($q) > 0) {
+                $s = "?" . http_build_query($q);
+            } else {
+                $s = "";
+            }
+            if ($t['kw']) {
                 $new_url = "/kw/" . $t['kw'] . ".html" . $s;
-
                 $content = str_replace('"' . $url . '"', '"' . $new_url . '"', $content);
             } else {
                 if ($t['cid']) {
-                    $q = [];
-                    //http://www.taoqu88.com/tao.php?r=l&cid=4&s=t&u=1350274&original_id=8150
-                    if ($t['original_id']){
-                        $q['original_id'] = $t['original_id'];
-                    }
-                    if (count($q) > 0) {
-                        $s = "?" . http_build_query($q);
-                    } else {
-                        $s = "";
-                    }
                     $new_url = "/category/" . $t['cid'] . ".html".$s;
                     $content = str_replace('"' . $url . '"', '"' . $new_url . '"', $content);
                 } else {