dever 5 years ago
parent
commit
be3f359a64

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

@@ -66,6 +66,17 @@ return array
             'value'     => Dever::input('search_option_info_id')
         ),
 
+        'page_id'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '章节',
+            'default'   => '',
+            'desc'      => '章节',
+            'match'     => 'is_numeric',
+            'update'    => 'text',
+            'value'     => Dever::input('send_page_id')
+        ),
+
         'type'     => array
         (
             'type'      => 'varchar-150',
@@ -183,5 +194,18 @@ return array
             'order' => array('reorder' => 'desc', 'id' => 'desc'),
             'col' => '*',
         ),
+
+        'child' => array
+        (
+            'option' => array
+            (
+                'state' => 1,
+                'page_id' => 'yes',
+                'info_id' => 'yes',
+            ),
+            'type' => 'all',
+            'order' => array('reorder' => 'desc', 'id' => 'desc'),
+            'col' => '*|page_id|',
+        ),
     )
 );

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

@@ -576,8 +576,10 @@ $config = array
 			'br2' => array('<br />'),
 			'list10' => array('榜单列表', '"collection_ranking&project=act&search_type=4&search_option_collection_id={id}&oper_table=info&oper_project=collection"' , '{audit} == 1 && {buy} == 1'),
 			'add1' => array('榜单设置', '"ranking&project=collection&search_option_info_id={id}&oper_table=info&oper_project=collection&oper_save_jump=info&where_id={id}"', '{audit} == 1 && {buy} == 1'),
+			'br3' => array('<br />'),
+			//'list' => array('内容管理', '"content&search_option_info_id={id}&oper_table=info&page_type=1"' , '{audit} == 1'),
 
-			'list' => array('内容管理', '"content&search_option_info_id={id}&oper_table=info&page_type=1"' , '{audit} == 1'),
+			'list2' => array('章节管理', '"page&search_option_info_id={id}&oper_table=info&page_type=1"' , '{audit} == 1'),
 			
 			'list1' => array('门票管理', '"buy&search_option_info_id={id}&oper_table=info"' , '{audit} == 1 && {buy} == 1'),
 		),

+ 56 - 0
app/collection/database/page.php

@@ -24,6 +24,17 @@ return array
 			'list'		=> true,
 		),
 
+		'info_id'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '合集',
+            'default'   => '',
+            'desc'      => '合集',
+            'match'     => 'is_numeric',
+            'update'    => 'hidden',
+            'value'     => Dever::input('search_option_info_id')
+        ),
+
 		'name'		=> array
 		(
 			'type' 		=> 'varchar-150',
@@ -37,6 +48,18 @@ return array
 			'edit'		=> true,
 		),
 
+		'page_id'		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> '上级章节',
+			'default' 	=> '-1',
+			'desc' 		=> '请选择上级章节',
+			'match' 	=> 'is_numeric',
+			'update'	=> 'hidden',
+			'value'		=> Dever::input('search_option_page_id', -1),
+			'list'		=> '{page_id} > 0 ? Dever::load("collection/page-one#name", {page_id}) : "主章节"',
+		),
+
 		'reorder'		=> array
 		(
 			'type' 		=> 'int-11',
@@ -76,11 +99,44 @@ return array
 
 	'manage' => array
 	(
+		# 列表页的类型
+		'list_type' => 'tree',
+		'list_button' => array
+		(
+			'update' => '编辑',
+			'add' => array('新增子章节', '"{page_id}" == -1 ? "page&search_option_page_id={id}" : "page&search_option_page_id={page_id},{id}"', '{page_id} == -1'),
 
+			'list' => array('内容管理', '"content&search_option_info_id={info_id}&send_page_id={id}&oper_table=page&top_table=info&top_project=collection&page_type=1"' , '{page_id} > 0'),
+			'delete' => '删除',
+		),
 	),
 
 	'request' => array
 	(
+		'child' => array
+		(
+			'option' => array
+			(
+				'state' => 1,
+				'page_id' => array(1, '>='),
+				'info_id' => 'yes',
+			),
+			'type' => 'all',
+			'order' => array('reorder' => 'desc', 'id' => 'desc'),
+			'col' => '*|page_id|',
+		),
 		
+		'main' => array
+		(
+			'option' => array
+			(
+				'state' => 1,
+				'page_id' => -1,
+				'info_id' => 'yes',
+			),
+			'type' => 'all',
+			'order' => array('reorder' => 'desc', 'id' => 'desc'),
+			'col' => '*',
+		),
 	)
 );

+ 4 - 2
app/collection/lib/Manage.php

@@ -213,13 +213,15 @@ class Manage
                     # 上级表和项目
                     $param['oper_table'] = 'content';
                     $param['oper_project'] = 'collection';
-                    $param['top_table'] = 'info';
+                    $param['top_table'] = 'page.info';
                     $param['top_project'] = 'collection';
                 } else {
                     $param['oper_save_table'] = 'content';
                     $param['oper_save_project'] = 'collection';
-                    $param['oper_table'] = 'info';
+                    $param['oper_table'] = 'page';
                     $param['oper_project'] = 'collection';
+                    $param['top_table'] = 'info';
+                    $param['top_project'] = 'collection';
                 }
                 
                 $data[$k]['data_editurl'] = $database->url($method, $v['id'], $table_name, '', $project_name, $param);

+ 24 - 0
app/collection/src/Api.php

@@ -23,6 +23,7 @@ class Api
         return Dever::db('collection/info')->state();
     }
 
+    # 获取合集下的内容
     public function getContent()
     {
         $id = Dever::input('id');
@@ -31,6 +32,29 @@ class Api
         return $data;
     }
 
+    # 获取合集下的分类
+    public function category()
+    {
+        $where['info_id'] = Dever::input('id');
+        $data['cate'] = Dever::db('collection/page')->main($where);
+        if ($data['cate']) {
+            $child = Dever::db('collection/page')->child($where);
+            $content = Dever::db('collection/content')->child($where);
+            foreach ($data['cate'] as $k => $v) {
+                if (isset($child[$v['id']])) {
+                    $data['cate'][$k]['child'] = $child[$v['id']];
+                    foreach ($data['cate'][$k]['child'] as $k1 => $v1) {
+                        if (isset($content[$v1['id']])) {
+                            $data['cate'][$k]['child'][$k1]['content'] = $content[$v1['id']];
+                        }
+                    }
+                }
+            }
+        }
+
+        return $data;
+    }
+
     public function ding($data)
     {
         if (isset($data['num_add_buy']) && isset($data['num_ratio_buy'])) {