dever 3 years ago
parent
commit
d640455306
2 changed files with 11 additions and 5 deletions
  1. 1 0
      app/collection/database/content.php
  2. 10 5
      app/collection/lib/Spider.php

+ 1 - 0
app/collection/database/content.php

@@ -53,6 +53,7 @@ return array
             'match'     => 'is_numeric',
             //'search'    => 'order',
             //'list'        => true,
+            'order'     => 'asc',
         ),
 
         'info_id'      => array

+ 10 - 5
app/collection/lib/Spider.php

@@ -81,12 +81,16 @@ class Spider
 
             if ($month < 4) {
                 $page_name .= '第1季';
+                $page_reorder = 4;
             } elseif ($month >= 4 && $month <= 6) {
                 $page_name .= '第2季';
+                $page_reorder = 3;
             } elseif ($month >= 7 && $month <= 9) {
                 $page_name .= '第3季';
+                $page_reorder = 2;
             } elseif ($month > 9) {
                 $page_name .= '第4季';
+                $page_reorder = 1;
             }
 
             # 按年生成子时光
@@ -112,7 +116,7 @@ class Spider
                 $month_name .= '下旬';
             }
             */
-            $reorder = -1*($month - 12) + 1;
+            $reorder = (-1*($month - 12))*10 + 100;
 
             # 按项目生成主时光
             $times_id_parent = $this->createTimes($id, $source_id, $main_name);
@@ -120,7 +124,7 @@ class Spider
                 $times_id = $this->createTimes($id, $source_id, $year_name, $year, $times_id_parent);
                 if ($times_id) {
 
-                    $parent_page_id = $this->createPage($id, $source_id, $page_name, -1, $times_id_parent, $times_id);
+                    $parent_page_id = $this->createPage($id, $source_id, $page_name, -1, $times_id_parent, $times_id, '', '', $page_reorder);
 
                     if ($parent_page_id) {
                         $cover = $pic[0];
@@ -164,8 +168,8 @@ class Spider
     	$where['source_id'] = $source_id;
     	$where['name'] = $name;
     	$where['page_id'] = $parent;
-    	$param['times_id_parent'] = $times_id_parent;
-    	$param['times_id'] = $times_id;
+    	$where['times_id_parent'] = $times_id_parent;
+    	$where['times_id'] = $times_id;
     	if ($desc) {
     		$param['desc'] = $desc;
     	}
@@ -184,10 +188,11 @@ class Spider
                 $param = array_merge($where, $param);
                 $id = Dever::db($table)->insert($param);
             } else {
-                $total = Dever::db('collection/content')->total(array('info_id' => $info_id, 'page_id' => $info['id']));
+                $total = Dever::db('collection/content')->total(array('info_id' => $info_id, 'page_id' => $info['id'], 'clear' => true));
 
                 if ($total >= $max) {
                     $num = $num+1;
+                    $reorder += $num;
                     $id = $this->createPage($info_id, $source_id, $name, $parent, $times_id_parent, $times_id, $desc, $pic, $reorder, $max, $num);
                 } else {
                     $id = $info['id'];