rabin 3 роки тому
батько
коміт
db1d2b9761
6 змінених файлів з 239 додано та 216 видалено
  1. 21 2
      database/col.php
  2. 23 17
      database/data.php
  3. 79 66
      database/module.php
  4. 31 4
      database/page.php
  5. 85 0
      database/page_module.php
  6. 0 127
      database/template.php

+ 21 - 2
database/col.php

@@ -11,6 +11,12 @@ $type = array
 	//7 => '多项选择',
 	8 => '时间选择',
 );
+
+$is_option = array
+(
+	1 => '必填',
+	2 => '选填',
+);
 return array
 (
 	# 表名
@@ -79,20 +85,33 @@ return array
             'default'   => '1',
             'desc'      => '类型',
             'match'     => 'is_numeric',
-            'update'  	=> 'select',
+            'update'  	=> 'radio',
             'option'    => $type,
             'search'    => 'select',
             'list'      => true,
             'control'	=> 'type',
         ),
 
+        'is_option'        => array
+        (
+            'type'      => 'tinyint-1',
+            'name'      => '是否必填',
+            'default'   => '1',
+            'desc'      => '是否必填',
+            'match'     => 'is_numeric',
+            'update'  	=> 'radio',
+            'option'    => $is_option,
+            'search'    => 'select',
+            'list'      => true,
+        ),
+
         'pic'       => array
         (
             'type'      => 'varchar-20',
             'name'      => '图片尺寸提醒-请直接输入尺寸,如100*100',
             'default'   => '',
             'desc'      => '图片尺寸提醒',
-            'match'     => 'is_string',
+            'match'     => 'option',
             'update'    => 'text',
             'show'      => 'type=4,5',
         ),

+ 23 - 17
database/data.php

@@ -7,15 +7,15 @@ $option = array
     2 => '不显示',
 );
 
-$type = Dever::db('push/info')->config['func'];
+$type = Dever::db('page/module')->config['func'];
 $type = $type();
 
 $list = function()
 {
-    return Dever::db('push/info')->state();
+    return Dever::db('page/module')->state();
 };
-$info = Dever::input('search_option_info_id', 1);
-Dever::setInput('search_option_info_id', $info);
+$info = Dever::input('search_option_module_id', 1);
+Dever::setInput('search_option_module_id', $info);
 $type_default = -1;
 $type_id = '0';
 
@@ -24,9 +24,9 @@ $data = array
     1 => '内容自定义',
 );
 $lang = array();
-$name = '推送数据管理';
+$name = '内容管理';
 if ($info) {
-    $info = Dever::db('push/info')->one($info);
+    $info = Dever::db('page/module')->one($info);
 
     if (!$info) {
         return;
@@ -62,18 +62,18 @@ $struct = array
         //'list'        => true,
     ),
 
-    'info_id'       => array
+    'module_id'       => array
     (
         'type'      => 'int-11',
-        'name'      => '所属推送位',
-        'default'   => Dever::input('search_option_info_id', '1'),
-        'desc'      => '推送位',
+        'name'      => '所属模块',
+        'default'   => Dever::input('search_option_module_id', '1'),
+        'desc'      => '模块',
         'match'     => 'is_numeric',
         'search'    => 'select',
         'update'    => 'hidden',
         'option'    => $list,
         'list'      => true,
-        'value'     => Dever::input('search_option_info_id', '1'),
+        'value'     => Dever::input('search_option_module_id', '1'),
     ),
 
     'type'      => array
@@ -98,7 +98,7 @@ $struct = array
         'match'     => 'option',
         'update'    => 'select',
         'show'      => 'type=' . $type_id,
-        'update_search' => 'push/lib/manage.search?{type}',
+        'update_search' => 'page/lib/manage.search?{type}',
     ),
 
     /*
@@ -111,14 +111,14 @@ $struct = array
         'match'     => 'is_string',
         'option'    => $data,
         'update'    => $data_update,
-        'list'      => 'Dever::load("push/lib/manage.show", {id})',
+        'list'      => 'Dever::load("page/lib/manage.show", {id})',
     ),
     */
 );
 
 if ($info) {
     $info['col'] = explode(',', $info['col']);
-    $col = Dever::db('push/col')->getAll();
+    $col = Dever::db('page/col')->getAll();
 
     if ($col) {
         $pic_index = 0;
@@ -162,6 +162,12 @@ if ($info) {
                     $update_type = 'day';
                 }
             }
+
+            if ($v['is_option'] == 1) {
+                $match = 'is_string';
+            } else {
+                $match = 'option';
+            }
     		
     		$struct[$key] = array
 	        (
@@ -170,7 +176,7 @@ if ($info) {
 	            'name'      => $v['name'],
 	            'default'   => '',
 	            'desc'      => $v['name'],
-	            'match'     => 'is_string',
+	            'match'     => $match,
 	            'update'    => $update_type,
 	            'place'     => $place,
 	            'key'       => 1,
@@ -246,7 +252,7 @@ return array
             # 匹配的正则或函数 选填项
             'option' => array
             (
-                'info_id' => 'yes',
+                'module_id' => 'yes',
                 'type_no' => array('yes-type', '!='),
                 'state' => 1,
             ),
@@ -262,7 +268,7 @@ return array
             # 匹配的正则或函数 选填项
             'option' => array
             (
-                'info_id' => 'yes',
+                'module_id' => 'yes',
                 'type_no' => array('yes-type', '!='),
                 'state' => 1,
             ),

+ 79 - 66
database/info.php → database/module.php

@@ -6,7 +6,7 @@ $func = function()
     (
         -1 => array('id' => '-1', 'name' => '自定义',),
     );
-    $info = Dever::db('push/func')->state();
+    $info = Dever::db('page/func')->state();
     if($info)
     {
         $array += $info;
@@ -20,7 +20,7 @@ $col = function()
     (
         
     );
-    $info = Dever::db('push/col')->state();
+    $info = Dever::db('page/col')->state();
     if($info)
     {
         $array += $info;
@@ -34,7 +34,7 @@ $page = function()
     (
         
     );
-    $info = Dever::db('push/page')->state();
+    $info = Dever::db('page/page')->state();
     if($info)
     {
         $array += $info;
@@ -42,36 +42,41 @@ $page = function()
     return $array;
 };
 
-$template = function()
-{
-    $array = array
-    (
-        
-    );
-    $info = Dever::load('push/lib/manage')->template();
-    if($info)
-    {
-        $array += $info;
-    }
-    return $array;
-};
+$content = array
+(
+    1 => '显示',
+    2 => '不显示',
+);
 
 return array
 (
     # 表名
-    'name' => 'info',
+    'name' => 'module',
     # 显示给用户看的名称
-    'lang' => '推送位管理',
-    'order' => 10,
-    'check' => 'key',
+    'lang' => '模块列表',
+    'order' => 2,
     'func' => $func,
+
+    'sync' => array
+    (
+        'page/page_module' => array
+        (
+            # 更新时的条件,另外一个表的字段 => 本表的字段
+            'where' => array('module_id', 'id'),
+            # 要更新的数据
+            'update' => array('page_id' => 'page_id'),
+            # 同步更新的类型,delete为先删再插入,update为先查询是否存在,存在直接更新,不存在则插入, only为仅更新
+            'type' => 'delete',
+        ),
+    ),
+
     # 数据结构
     'struct' => array
     (
         'id'        => array
         (
             'type'      => 'int-11',
-            'name'      => '推送位ID',
+            'name'      => '模块ID',
             'default'   => '',
             'desc'      => '',
             'match'     => 'is_numeric',
@@ -83,9 +88,9 @@ return array
         'name'      => array
         (
             'type'      => 'varchar-60',
-            'name'      => '推送位标题',
+            'name'      => '模块标题',
             'default'   => '',
-            'desc'      => '请输入推送位标题',
+            'desc'      => '请输入模块标题',
             'match'     => 'is_string',
             'update'    => 'text',
             'search'    => 'fulltext',
@@ -96,96 +101,114 @@ return array
         'key'       => array
         (
             'type'      => 'varchar-60',
-            'name'      => '推送位标识',
+            'name'      => '模块标识',
             'default'   => '',
-            'desc'      => '推送位标识',
+            'desc'      => '模块标识',
             'match'     => 'is_string',
-            'update'    => Dever::input('where_id') ? 'hidden' : 'text',
+            'update'    => 'text',
             'search'    => 'fulltext',
             'list'      => true,
         ),
 
+        'pic'       => array
+        (
+            'type'      => 'varchar-150',
+            'name'      => '模块图片',
+            'default'   => '',
+            'desc'      => '模块图片',
+            'match'     => 'option',
+            'update'    => 'image',
+            'key'       => 1,
+        ),
+
         'desc'      => array
         (
-            'type'      => 'varchar-800',
-            'name'      => '推送位描述',
+            'type'      => 'varchar-2000',
+            'name'      => '模块描述',
             'default'   => '',
-            'desc'      => '推送位描述',
+            'desc'      => '模块描述',
             'match'     => 'is_string',
-            'update'    => 'textarea',
+            'update'    => 'editor',
+            'key'       => 1,
+        ),
+
+        'content'        => array
+        (
+            'type'      => 'tinyint-1',
+            'name'      => '是否显示内容',
+            'default'   => '1',
+            'desc'      => '是否显示内容',
+            'match'     => 'is_numeric',
+            'update'    => 'radio',
+            'option'    => $content,
+            'control'   => 'content',
+            'tab'       => 1,
         ),
 
         'num'       => array
         (
             'type'      => 'int-11',
-            'name'      => '数据显示条数-为空或小于0则取默认值10,只对前台有效,当有分页时,则为每页显示的条数',
+            'name'      => '内容显示条数-为空或小于0则取默认值10,只对前台有效,当有分页时,则为每页显示的条数',
             'default'   => '10',
-            'desc'      => '数据显示条数',
+            'desc'      => '内容显示条数',
             'match'     => 'is_numeric',
             'update'    => 'text',
-            'list'      => true,
-            'edit'      => true,
+            //'list'      => true,
+            //'edit'      => true,
             'tab'       => 1,
+            'show'      => 'content=1',
         ),
 
         'page_id'       => array
         (
-            'type'      => 'int-11',
+            'type'      => 'varchar-100',
             'name'      => '所属页面',
             'default'   => '',
             'desc'      => '所属页面',
-            'match'     => 'is_numeric',
+            'match'     => 'is_string',
             'option'    => $page,
-            'update'    => 'radio',
+            'update'    => 'checkbox',
             'search'    => 'select',
             'list'      => true,
             'list_order' => -1,
         ),
 
-        'template_id'       => array
-        (
-            'type'      => 'int-11',
-            'name'      => '样式模板',
-            'default'   => '',
-            'desc'      => '样式模板',
-            'match'     => 'is_numeric',
-            'option'    => $template,
-            'update'    => 'selector',
-        ),
-
         'func'       => array
         (
             'type'      => 'varchar-300',
-            'name'      => '功能类型',
+            'name'      => '内容功能类型',
             'default'   => '',
             'desc'      => '功能类型',
             'match'     => 'is_string',
             'option'    => $func,
             'update'    => 'checkbox',
             'tab'       => 1,
+            'show'      => 'content=1',
         ),
 
         'col'       => array
         (
             'type'      => 'varchar-300',
-            'name'      => '启用的字段',
+            'name'      => '内容启用的字段',
             'default'   => '',
             'desc'      => '请选择启用的字段',
             'match'     => 'is_string',
             'option'    => $col,
             'update'    => 'checkbox',
             'tab'       => 1,
+            'show'      => 'content=1',
         ),
 
         'col_pic'       => array
         (
             'type'      => 'varchar-500',
-            'name'      => '图片尺寸提醒-请直接输入提醒的文字即可,如100*100,如果有多个图片字段,请用换行隔开',
+            'name'      => '内容图片尺寸提醒-请直接输入提醒的文字即可,如100*100,如果有多个图片字段,请用换行隔开',
             'default'   => '',
             'desc'      => '图片尺寸提醒',
             'match'     => 'option',
             'update'    => 'textarea',
             'tab'       => 1,
+            'show'      => 'content=1',
         ),
         
         'reorder'       => array
@@ -201,7 +224,6 @@ return array
             'list'      => true,
             'order'     => 'desc',
             'edit'        => true,
-            'tab'       => 1,
         ),
 
         'state'     => array
@@ -234,33 +256,24 @@ return array
         # 所属项目
         'project' => 'module',
         # 项目名称
-        'project_name' => '推送位管理',
+        'project_name' => '模块管理',
     ),
     */
 
     'manage' => array
     (
         'lang' => 'name,desc',
-        'tab' => array('基本配置', '功能配置'),
+        'tab' => array('基本配置', '内容配置'),
         'delete' => false,
         //'edit' => false,
         //'insert' => $curPage ? true : false,
 
-        # 自定义快捷新增和编辑
-        'button' => array
-        (
-            //'新增兑换码' => array('fast', 1, 'config&where_id=1'),
-            '页面配置' => array('list', 'page&project=push&oper_parent=info&oper_project=push'),
-            '模板配置' => array('list', 'template&project=push&oper_parent=info&oper_project=push'),
-            '字段配置' => array('list', 'col&project=push&oper_parent=info&oper_project=push'),
-            '功能配置' => array('list', 'func&project=push&oper_parent=info&oper_project=push'),
-        ),
 
         'list_button' => array
         (
-            'add' => array('新增数据', '"data&search_option_info_id={id}&oper_parent=info"'),
+            'add' => array('新增内容', '"data&search_option_module_id={id}&oper_parent=module"', '{content} == 1'),
 
-            'list' => array('数据列表', '"data&search_option_info_id={id}&oper_parent=info"'),
+            'list' => array('内容列表', '"data&search_option_module_id={id}&oper_parent=module"', '{content} == 1'),
         ),
     ),
 
@@ -274,7 +287,7 @@ return array
             'option' => array
             (
                 'type' => 'yes',
-                //'page_id' => 'yes',
+                'page_id' => 'yes',
                 'state' => 1,
             ),
             'type' => 'all',

+ 31 - 4
database/page.php

@@ -5,10 +5,9 @@ return array
 	# 表名
 	'name' => 'page',
 	# 显示给用户看的名称
-	'lang' => '页面配置',
+	'lang' => '页面列表',
 	# 后台菜单排序
-	'order' => 3,
-	'menu' => false,
+	'order' => 1,
 	'check' => 'key',
 	# 数据结构
 	'struct' => array
@@ -49,9 +48,20 @@ return array
             'list'      => true,
         ),
 
+        'pic'       => array
+        (
+            'type'      => 'varchar-150',
+            'name'      => '页面图片',
+            'default'   => '',
+            'desc'      => '页面图片',
+            'match'     => 'option',
+            'update'    => 'image',
+            'key'       => 1,
+        ),
+
 		'desc'		=> array
 		(
-			'type' 		=> 'varchar-200',
+			'type' 		=> 'varchar-2000',
 			'name' 		=> '页面描述',
 			'default' 	=> '',
 			'desc' 		=> '页面描述',
@@ -61,6 +71,21 @@ return array
 			'list'		=> true,
 		),
 
+		'reorder'       => array
+        (
+            'type'      => 'int-11',
+            'name'      => '排序(数值越大越靠前)',
+            'default'   => '1',
+            'desc'      => '请输入排序',
+            'match'     => 'option',
+            'update'    => 'text',
+            'search'    => 'order',
+            'list_name' => '排序',
+            'list'      => true,
+            'order'     => 'desc',
+            'edit'        => true,
+        ),
+
 		'state'		=> array
 		(
 			'type' 		=> 'tinyint-1',
@@ -92,6 +117,8 @@ return array
 		'button' => array
 		(
 			'新增' => array('fast'),
+            '字段配置' => array('list', 'col&oper_parent=page'),
+            '功能配置' => array('list', 'func&oper_parent=page'),
 		),
 		# 快捷更新
 		'list_button' => array

+ 85 - 0
database/page_module.php

@@ -0,0 +1,85 @@
+<?php
+
+return array
+(
+	# 表名
+	'name' => 'page_module',
+	# 显示给用户看的名称
+	'lang' => '页面模块关联表',
+	'menu' => false,
+
+	# 数据结构
+	'struct' => array
+	(
+		'id' 		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> 'ID',
+			'default' 	=> '',
+			'desc' 		=> '',
+			'match' 	=> 'is_numeric',
+			'search'	=> 'order',
+			'list'		=> true,
+		),
+		
+		'page_id'		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> '页面ID',
+			'default' 	=> '',
+			'desc' 		=> '页面ID',
+			'match' 	=> 'is_numeric',
+			'update'	=> 'text',
+			'list'		=> true,
+		),
+
+		'module_id'		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> '模块ID',
+			'default' 	=> '',
+			'desc' 		=> '模块ID',
+			'match' 	=> 'is_numeric',
+			'update'	=> 'text',
+			'list'		=> true,
+		),
+		
+		'cdate'		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> '录入时间',
+			'match' 	=> array('is_numeric', DEVER_TIME),
+			'desc' 		=> '',
+			# 只有insert时才生效
+			'insert'	=> true,
+			'list'		=> 'date("Y-m-d H:i:s", {cdate})',
+		),
+	),
+
+	# request 请求接口定义
+	'request' => array
+	(
+		'getData' => array
+	    (
+	        'where' => array
+	        (
+	            'page_id' => 'yes-t_1.page_id',
+	            'state' => 'yes-t_2.state-1',
+	        ),
+
+	        'join' => array
+			(
+				array
+				(
+					'table' => 'page/module',
+					'type' => 'left join',
+					'on' => array('module_id','id'),
+					'col' => 't_1.id as tid',
+				),
+			),
+	        'type' => 'all',
+	        'order' => array('t_2.reorder' => 'desc', 't_2.id' => 'desc'),
+			'col' => 'id,t_2.*',
+	    ),
+	)
+);

+ 0 - 127
database/template.php

@@ -1,127 +0,0 @@
-<?php
-
-return array
-(
-	# 表名
-	'name' => 'template',
-	# 显示给用户看的名称
-	'lang' => '模板配置',
-	# 后台菜单排序
-	'order' => 3,
-	'menu' => false,
-	'check' => 'key',
-	# 数据结构
-	'struct' => array
-	(
-		'id' 		=> array
-		(
-			'type' 		=> 'int-11',
-			'name' 		=> 'ID',
-			'default' 	=> '',
-			'desc' 		=> '',
-			'match' 	=> 'is_numeric',
-			'search'	=> 'order',
-			'list'		=> true,
-			'order'		=> 'desc',
-		),
-		
-		'name'		=> array
-		(
-			'type' 		=> 'varchar-32',
-			'name' 		=> '模板名称',
-			'default' 	=> '',
-			'desc' 		=> '模板名称',
-			'match' 	=> 'is_string',
-			'update'	=> 'text',
-			'search'	=> 'fulltext',
-			'list'		=> true,
-		),
-
-		'key'       => array
-        (
-            'type'      => 'varchar-60',
-            'name'      => '模板标识',
-            'default'   => '',
-            'desc'      => '模板标识',
-            'match'     => 'is_string',
-            'update'    => Dever::input('where_id') ? 'hidden' : 'text',
-            'search'    => 'fulltext',
-            'list'      => true,
-        ),
-
-		'desc'		=> array
-		(
-			'type' 		=> 'varchar-200',
-			'name' 		=> '模板描述',
-			'default' 	=> '',
-			'desc' 		=> '模板描述',
-			'match' 	=> 'is_string',
-			'update'	=> 'textarea',
-			'search'	=> 'fulltext',
-			'list'		=> true,
-		),
-
-		'pic'       => array
-        (
-            'type'      => 'varchar-150',
-            'name'      => '模板图片',
-            'default'   => '',
-            'desc'      => '模板图片',
-            'match'     => 'option',
-            'update'    => 'image',
-            'key'       => '1',
-        ),
-
-		'state'		=> array
-		(
-			'type' 		=> 'tinyint-1',
-			'name' 		=> '状态',
-			'default' 	=> '1',
-			'desc' 		=> '请选择状态',
-			'match' 	=> 'is_numeric',
-		),
-		
-		'cdate'		=> array
-		(
-			'type' 		=> 'int-11',
-			'name' 		=> '录入时间',
-			'match' 	=> array('is_numeric', time()),
-			'desc' 		=> '',
-			# 只有insert时才生效
-			'insert'	=> true,
-			'list'		=> 'date("Y-m-d H:i:s", {cdate})',
-		),
-	),
-
-	'manage' => array
-	(
-		'lang' => 'name,desc',
-		'insert' => false,
-		'edit' => false,
-
-		# 自定义快捷新增和编辑
-		'button' => array
-		(
-			'新增' => array('fast'),
-		),
-		# 快捷更新
-		'list_button' => array
-		(
-			'edit' => array('编辑'),
-		),
-	),
-
-	'default' => array
-	(
-		'col' => '`name`,`desc`,`key`,`state`,`cdate`',
-		'value' => array
-		(
-			'"默认模板","默认模板", "home", 1,' . DEVER_TIME,
-		),
-	),
-
-	'request' => array
-	(
-		
-	),
-);