rabin 2 years ago
parent
commit
9a31487274

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

@@ -732,6 +732,7 @@ $config = array
             'br3' => array('<br />'),
 
             'list5' => array('章节', '"page&search_option_info_id={id}&oper_table=info"' , '{audit} == 1'),
+            //'list5' => array('内容', '"times&search_option_info_id={id}&oper_table=info"' , '{audit} == 1'),
 
             'list6' => array('榜单', '"ranking&project=collection&search_option_info_id={id}&oper_table=info&oper_project=collection&where_id={id}"', '{audit} == 1'),
 

+ 22 - 20
app/collection/database/times.php

@@ -1,6 +1,6 @@
 <?php
 
-$times_id = Dever::input('option_times_id', -1);
+$parent_id = Dever::input('option_parent_id', -1);
 return array
 (
 	# 表名
@@ -65,9 +65,9 @@ return array
 			'default' 	=> '',
 			'desc' 		=> '年份',
 			'match' 	=> 'is_numeric',
-			'update'    => $times_id < 0 ? 'hidden': 'year',
+			'update'    => $parent_id < 0 ? 'hidden': 'year',
 			'search'	=> 'text',
-			'order'		=> 'desc',
+			//'order'		=> 'desc',
 			'list'		=> true,
 		),
 
@@ -78,13 +78,13 @@ return array
 			'default' 	=> '',
 			'desc' 		=> '年份',
 			'match' 	=> 'option',
-			'update'    => $times_id < 0 ? 'hidden': 'year',
+			'update'    => $parent_id < 0 ? 'hidden': 'year',
 			'search'	=> 'text',
 			'order'		=> 'desc',
 			'list'		=> true,
 		),
 
-		'times_id'		=> array
+		'parent_id'		=> array
 		(
 			'type' 		=> 'int-11',
 			'name' 		=> '上级时光',
@@ -92,8 +92,8 @@ return array
 			'desc' 		=> '请选择上级时光',
 			'match' 	=> 'is_numeric',
 			'update'	=> 'hidden',
-			'value'		=> $times_id,
-			'list'		=> '{times_id} > 0 ? Dever::load("collection/times-one#name", {times_id}) : "主时间线"',
+			'value'		=> $parent_id,
+			'list'		=> '{parent_id} > 0 ? Dever::load("collection/times-one#name", {parent_id}) : "主时间线"',
 		),
 
 		'icon'     => array
@@ -103,7 +103,7 @@ return array
             'default'   => '',
             'desc'      => '时光图标',
             'match'     => 'option',
-            'update'    => $times_id < 0 ? 'hidden': 'image',
+            'update'    => $parent_id < 0 ? 'hidden': 'image',
             'key'       => '1',
             'place'     => '80*80',
         ),
@@ -115,7 +115,7 @@ return array
             'default'   => '',
             'desc'      => '图片',
             'match'     => 'option',
-            'update'    => $times_id < 0 ? 'hidden': 'image',
+            'update'    => $parent_id < 0 ? 'hidden': 'image',
             'key'       => '1',
             'place'     => '330*330',
         ),
@@ -127,7 +127,7 @@ return array
             'default'   => '',
             'desc'      => '描述',
             'match'     => 'option',
-            'update'    => $times_id < 0 ? 'hidden': 'text',
+            'update'    => $parent_id < 0 ? 'hidden': 'text',
             //'list'        => true,
         ),
 
@@ -138,7 +138,7 @@ return array
             'default'   => '#ffffff',
             'desc'      => '文字颜色',
             'match'     => 'is_string',
-            'update'    => $times_id < 0 ? 'hidden': 'color',
+            'update'    => $parent_id < 0 ? 'hidden': 'color',
         ),
 
         'bgcolor'      => array
@@ -148,7 +148,7 @@ return array
             'default'   => '#cccccc',
             'desc'      => '背景颜色',
             'match'     => 'is_string',
-            'update'    => $times_id < 0 ? 'hidden': 'color',
+            'update'    => $parent_id < 0 ? 'hidden': 'color',
         ),
 
 		'reorder'		=> array
@@ -195,8 +195,10 @@ return array
 		'list_type' => 'tree',
 		'list_button' => array
 		(
-			'update' => array('编辑', 'times&option_times_id={times_id}'),
-			'add' => array('新增时间线', '"{times_id}" == -1 ? "times&option_times_id={id}" : "times&option_times_id={times_id},{id}"', '{times_id} == -1'),
+			'update' => array('编辑', 'times&option_parent_id={parent_id}'),
+			'add' => array('新增时间线', '"{parent_id}" == -1 ? "times&option_parent_id={id}" : "times&option_parent_id={parent_id},{id}"', '{parent_id} == -1'),
+
+			'list5' => array('章节', '"page&search_option_info_id={info_id}&search_option_times_id_parent={times_id}&search_option_times_id={id}&oper_table=times&top_table=info"' , '{parent_id} > 0'),
 			'delete' => '删除',
 		),
 	),
@@ -208,7 +210,7 @@ return array
 			'option' => array
 			(
 				'state' => 1,
-				'times_id' => 'yes',
+				'parent_id' => 'yes',
 				'info_id' => 'yes',
 			),
 			'type' => 'all',
@@ -221,7 +223,7 @@ return array
 			'option' => array
 			(
 				'state' => 1,
-				'times_id' => -1,
+				'parent_id' => -1,
 				'info_id' => 'yes',
 			),
 			'type' => 'all',
@@ -234,7 +236,7 @@ return array
 			'option' => array
 			(
 				'state' => 1,
-				'times_id' => -1,
+				'parent_id' => -1,
 				'info_id' => 'yes',
 			),
 			'type' => 'all',
@@ -247,13 +249,13 @@ return array
 		(
 			'option' => array
 			(
-				'times_id' => array(1, '>='),
+				'parent_id' => array(1, '>='),
 				'info_id' => 'yes',
 				'state' => 1,
 			),
 			'type' => 'all',
 			'order' => array('year' => 'asc', 'reorder' => 'asc', 'id' => 'asc'),
-			'col' => '*|times_id|id|',
+			'col' => '*|parent_id|id|',
 		),
 
 		'getNew' => array
@@ -261,7 +263,7 @@ return array
 			'option' => array
 			(
 				'state' => 1,
-				'times_id' => array(1, '>='),
+				'parent_id' => array(1, '>='),
 				'year' => 'yes',
 				'info_id' => 'yes',
 			),

+ 2 - 0
app/collection/index.php

@@ -5,4 +5,6 @@ define('DEVER_APP_LANG', '合集管理');
 define('DEVER_APP_PATH', dirname(__FILE__) . DIRECTORY_SEPARATOR);
 define('DEVER_MANAGE_ORDER', 100);
 define('DEVER_MANAGE_ICON', 'glyphicon-shopping-cart layui-icon-unlink');
+define('DEVER_GROUP_ORDER', 1);
+define('DEVER_GROUP_NAME', '基本功能');
 include(DEVER_APP_PATH . '../boot.php');

+ 19 - 15
app/collection/lib/Core.php

@@ -284,22 +284,26 @@ class Core
     # 获取按钮的样式
     protected function button($info)
     {
-        $button = array(
-            'bgcolor' => 'background: linear-gradient(to right, #000000,#000000) !important;color:#fff;',
-            'color' => 'color:#fff',
-            'name' => array('入口', '排行榜')
-        );
-
-        $button['name'] = explode(',', $info['button']);
-        if ($info['button_bgcolor'] && $info['button_bgjcolor']) {
-            $button['bgcolor'] = 'background: linear-gradient(to right, '.$info['button_bgcolor'].','.$info['button_bgjcolor'].') !important;';
-        }
-        if ($info['button_ftcolor']) {
-            $button['color'] = 'color:' . $info['button_ftcolor'];
-            $button['bgcolor'] .= $button['color'];
-        }
+        if (isset($info['button'])) {
+            $button = array(
+                'bgcolor' => 'background: linear-gradient(to right, #000000,#000000) !important;color:#fff;',
+                'color' => 'color:#fff',
+                'name' => array('入口', '排行榜')
+            );
+
+            $button['name'] = explode(',', $info['button']);
+            if ($info['button_bgcolor'] && $info['button_bgjcolor']) {
+                $button['bgcolor'] = 'background: linear-gradient(to right, '.$info['button_bgcolor'].','.$info['button_bgjcolor'].') !important;';
+            }
+            if ($info['button_ftcolor']) {
+                $button['color'] = 'color:' . $info['button_ftcolor'];
+                $button['bgcolor'] .= $button['color'];
+            }
 
-        return $button;
+            return $button;
+        } else {
+            return array();
+        }
     }
 
     # 获取其他页面的分享

+ 6 - 5
app/collection/lib/Create.php

@@ -8,10 +8,11 @@ use Dever\Support\Img as Handle;
 class Create
 {
     # 自动创建
-    public function up_commit($info_id, $source_id, $name, $desc, $year, $type = 11, $data, $cover = '')
+    public function up($info_id, $source_id, $name, $desc, $year, $type = 11, $data, $cover = '')
     {
         Dever::config('base')->hook = true;
         $where['info_id'] = $info_id;
+        $where['clear'] = true;
 
         $info = Dever::db('collection/content')->getNew($where);
 
@@ -19,8 +20,8 @@ class Create
         	$data = explode(',', $data);
         	if (!$cover) {
         		$cover = $data[0];
-	            //$cover = Dever::load('upload/view')->get($cover, 't', 1);
-	            //$cover = Dever::load('upload/view')->get($cover, 'c', 1);
+	            $cover = Dever::load('upload/view')->get($cover, 't', 1);
+	            $cover = Dever::load('upload/view')->get($cover, 'c', 1);
         	}
         }
 
@@ -47,7 +48,7 @@ class Create
                         $times = Dever::db('collection/times')->find($page['times_id']);
 
                         $result['times_reorder'] = $times['reorder'] + 1;
-                        $result['times_id'] = $this->createTimes($info_id, $source_id, $result['times_reorder'], '', $year, $result['parent_times_id']);
+                        $result['times_id'] = $this->createTimes($info_id, $source_id, $result['times_reorder'], '', $times['year'] + 1, $result['parent_times_id']);
 
                     } else {
                         $result['parent_page_reorder'] = $parent_page['reorder'] + 1;
@@ -102,7 +103,7 @@ class Create
     	$table = 'collection/times';
     	$where['info_id'] = $info_id;
     	$where['source_id'] = $source_id;
-    	$where['times_id'] = $parent;
+    	$where['parent_id'] = $parent;
     	if ($name) {
     		$where['name'] = $name;
     	} else {

+ 39 - 3
app/collection/lib/Spider.php

@@ -31,9 +31,44 @@ class Spider
 		$this->pic($data);
 	}
 
-    # 从采集的数据导入 一天采集一次,一次使用12
+    # 从采集的数据导入 一天采集一次,一次使用15
     public function import_api()
     {
+        $info_id = Dever::input('info_id', 1);
+
+        $info = Dever::db('spider/project')->find($info_id);
+
+        $where['use'] = 1;
+        $where['limit'] = '0,15';
+        $data = Dever::db('spider/data')->getAll($where);
+
+        $name = $info['config'] ? $info['config'] : $info['name'];
+        $year = date('Y');
+        $type = 11;
+
+        if ($info['config']) {
+            parse_str($info['config'], $config);
+            if (isset($config['name'])) {
+                $name = $config['name'];
+            }
+            if (isset($config['year'])) {
+                $year = $config['year'];
+            }
+            if (isset($config['type'])) {
+                $type = $config['type'];
+            }
+        }
+
+        foreach ($data as $k => $v) {
+            $value = Dever::json_decode($v['value']);
+            if (isset($value['name']) && isset($value['pic'])) {
+                Dever::load('collection/lib/create.up', $info_id, $v['id'], $name, $value['name'], $year, $type, $value['pic'], $value['pic'][0]);
+            }
+            
+            Dever::db('spider/data')->update(array('where_id' => $v['id'], 'use' => 2));
+        }
+
+        return 'ok';
 
         # 导入到唯美中
         # 每年12期,
@@ -42,11 +77,12 @@ class Spider
 
         $name = '测试';
         $desc = '测试测试';
-        $year = '2022';
+        $year = date('Y');
+        $type = 11;
 
         $data = 'https://img.lianzhixiu.com/uploads/allimg/202003/9999/43eefe151d.jpg,https://img.lianzhixiu.com/uploads/allimg/202003/9999/31020deb3d.jpg';
 
-        $result = Dever::load('collection/lib/create.up_commit', $info_id, $source_id, $name, $desc, $year, $type = 11, $data, $cover = '');
+        $result = Dever::load('collection/lib/create.up_commit', $info_id, $source_id, $name, $desc, $year, $type, $data, $cover = '');
 
         print_r($result);die;
         echo 1;die;

+ 2 - 0
app/community/index.php

@@ -5,4 +5,6 @@ define('DEVER_APP_LANG', '社区管理');
 define('DEVER_APP_PATH', dirname(__FILE__) . DIRECTORY_SEPARATOR);
 define('DEVER_MANAGE_ORDER', 100);
 define('DEVER_MANAGE_ICON', 'glyphicon glyphicon-tower layui-icon-reply-fill');
+define('DEVER_GROUP_ORDER', 10);
+define('DEVER_GROUP_NAME', '社区管理');
 include(DEVER_APP_PATH . '../boot.php');

+ 2 - 0
app/content/index.php

@@ -5,4 +5,6 @@ define('DEVER_APP_LANG', '内容管理');
 define('DEVER_APP_PATH', dirname(__FILE__) . DIRECTORY_SEPARATOR);
 define('DEVER_MANAGE_ORDER', 200);
 define('DEVER_MANAGE_ICON', 'glyphicon glyphicon-tower layui-icon-tabs');
+define('DEVER_GROUP_ORDER', 10);
+define('DEVER_GROUP_NAME', '基本功能');
 include(DEVER_APP_PATH . '../boot.php');

+ 2 - 0
app/im/index.php

@@ -5,4 +5,6 @@ define('DEVER_APP_LANG', '聊天组件');
 define('DEVER_APP_PATH', dirname(__FILE__) . DIRECTORY_SEPARATOR);
 define('DEVER_MANAGE_ORDER', 10);
 define('DEVER_MANAGE_ICON', 'glyphicon glyphicon-tower layui-icon-reply-fill');
+define('DEVER_GROUP_ORDER', 1);
+define('DEVER_GROUP_NAME', '社区管理');
 include(DEVER_APP_PATH . '../boot.php');

+ 2 - 0
app/user/index.php

@@ -5,4 +5,6 @@ define('DEVER_APP_LANG', '用户行为');
 define('DEVER_APP_PATH', dirname(__FILE__) . DIRECTORY_SEPARATOR);
 define('DEVER_MANAGE_ORDER', 199);
 define('DEVER_MANAGE_ICON', 'glyphicon glyphicon-tower layui-icon-theme');
+define('DEVER_GROUP_ORDER', 9);
+define('DEVER_GROUP_NAME', '社区管理');
 include(DEVER_APP_PATH . '../boot.php');

+ 2 - 0
main/index.php

@@ -5,4 +5,6 @@ define('DEVER_APP_LANG', '基础设置');
 define('DEVER_APP_PATH', dirname(__FILE__) . DIRECTORY_SEPARATOR);
 define('DEVER_MANAGE_ORDER', 98);
 define('DEVER_MANAGE_ICON', 'glyphicon glyphicon-tower layui-icon-component');
+define('DEVER_GROUP_ORDER', -1);
+define('DEVER_GROUP_NAME', '系统配置');
 include(DEVER_APP_PATH . '../boot.php');