dever 3 years ago
parent
commit
e629837983
1 changed files with 34 additions and 15 deletions
  1. 34 15
      app/collection/lib/Spider.php

+ 34 - 15
app/collection/lib/Spider.php

@@ -35,9 +35,10 @@ class Spider
     public function pic($data)
     {
     	$id = Dever::input('info_id');
-    	$name = Dever::input('time_name');
+        $main_name = Dever::input('main_name', '图片收集序列');
+    	$page_name = Dever::input('page_name');
         $page_desc = Dever::input('page_desc');
-    	if (!$id || !$name || !$page_desc) {
+    	if (!$id || !$main_name || !$page_name || !$page_desc) {
     		return;
     	}
         if (!isset($data['pic'])) {
@@ -50,36 +51,54 @@ class Spider
         $source_id = $data['project_id'];
         $date = explode('-', $data['cdate']);
 
-        # 按年生成子时光
-        $year = $date[0];
+        $year = intval($date[0]);
+        $month = intval($date[1]);
+        $day = intval($date[2]);
+
+        if ($month < 4) {
+            $page_name .= '第1季';
+        } elseif ($month >= 4 && $month <= 6) {
+            $page_name .= '第2季';
+        } elseif ($month >= 7 && $month <= 9) {
+            $page_name .= '第3季';
+        } elseif ($month > 9) {
+            $page_name .= '第4季';
+        }
 
-        # 按月生成主章节
-        $month = $date[1] . '月';
+        # 按年生成子时光
+        $year_name = $year . '年';
 
-        # 按天生成子章节
-        $day = $date[2] . '日';
+        # 按生成子章节
+        $month_name = $month . '月';
 
-        $main_name = '收集者';
+        # 按天生成内容名称
+        $day_name = $data['name'];
+        $day_name = '第' . $day . '日';
 
-        $content_name = $data['name'];
-        $content_name = $year . '年' . $month . $day;
+        if ($day <= 10) {
+            $month_name .= '上旬';
+        } elseif ($day > 10 && $day <= 20) {
+            $month_name .= '中旬';
+        } elseif ($day > 20) {
+            $month_name .= '下旬';
+        }
 
         # 按项目生成主时光
         $times_id_parent = $this->createTimes($id, $source_id, $main_name);
         if ($times_id_parent) {
-        	$times_id = $this->createTimes($id, $source_id, $year . '年', $year, $times_id_parent);
+        	$times_id = $this->createTimes($id, $source_id, $year_name, $year, $times_id_parent);
         	if ($times_id) {
 
-        		$parent_page_id = $this->createPage($id, $source_id, $name, -1, $times_id_parent, $times_id);
+        		$parent_page_id = $this->createPage($id, $source_id, $page_name, -1, $times_id_parent, $times_id);
 
         		if ($parent_page_id) {
                     $cover = $pic[0];
                     $cover = Dever::load('upload/view')->get($cover, 't', 1);
                     $cover = Dever::load('upload/view')->get($cover, 'c', 1);
-        			$page_id = $this->createPage($id, $source_id, $month, $parent_page_id, $times_id_parent, $times_id, $page_desc, $cover);
+        			$page_id = $this->createPage($id, $source_id, $month_name, $parent_page_id, $times_id_parent, $times_id, $page_desc, $cover);
 
         			if ($page_id) {
-        				$content_id = $this->createContent($id, $source_id, $page_id, 11, $content_name, $cover);
+        				$content_id = $this->createContent($id, $source_id, $page_id, 11, $day_name, $cover);
         				if ($content_id) {
         					$this->createPic($id, $content_id, $pic);
         				}