陈德本 vor 6 Jahren
Ursprung
Commit
866dad8095
3 geänderte Dateien mit 19 neuen und 6 gelöschten Zeilen
  1. 5 1
      App/Api/Config/Route.php
  2. 3 1
      App/Api/Controller/Category.php
  3. 11 4
      App/Api/Model/Dataoke.php

+ 5 - 1
App/Api/Config/Route.php

@@ -15,7 +15,11 @@ class Route extends Config
     protected static $data = [
         [
             "name" => "分类",
-            "pattern" => "/category/:s.html",//api/material/sort/beauty/pre
+            "pattern" => "/category/:s/index.html",//api/material/sort/beauty/pre
+            "action" => "Heanup\App\Api\Controller\Category"
+        ],[
+            "name" => "分类",
+            "pattern" => "/category/:s/page_:s.html",//api/material/sort/beauty/pre
             "action" => "Heanup\App\Api\Controller\Category"
         ], [
             "name" => "搜索",

+ 3 - 1
App/Api/Controller/Category.php

@@ -12,7 +12,9 @@ class Category extends Controller
 {
     protected function main()
     {
-        $id = $this->getQuery()->intval("id");
+//        $id = $this->getQuery()->intval("id");
+        $id = $this->getQuery()->string("args_0");
+        $page = $this->getQuery()->string("args_1");
         $request = [
             'r' => 'l',
             'site' => 'classify',

+ 11 - 4
App/Api/Model/Dataoke.php

@@ -19,9 +19,9 @@ class Dataoke
         $data = $rt->all();
         $data = array_unique($data);
         foreach ($data as $k => $url) {
-//            if (strstr($url, "tao.php") === false) {
-//                continue;
-//            }
+            if (strstr($url, "tao.php") === false) {
+                continue;
+            }
             $query = parse_url($url);
 
             $t = parse_query($query['query']);
@@ -57,7 +57,14 @@ class Dataoke
                     } else {
                         $s = "";
                     }
-                    $new_url = "/category/" . $t['cid'] . ".html".$s;
+                    if ($t['page']){
+                        $new_url = "/category/".$t['cid']."/page_" . $t['page'] . ".html".$s;
+                        $content = str_replace('"' . $url . '"', '"' . $new_url . '"', $content);
+                        $url=htmlentities($url);
+                        $content = str_replace('"' . $url . '"', '"' . $new_url . '"', $content);
+                    }else{
+                        $new_url = "/category/" . $t['cid'] . "/index.html".$s;
+                    }
                     $content = str_replace('"' . $url . '"', '"' . $new_url . '"', $content);
                 } else {
                     if ($t['id']) {