dever 6 anni fa
parent
commit
afb55be0fb
2 ha cambiato i file con 139 aggiunte e 1 eliminazioni
  1. 114 0
      journal/database/cate.php
  2. 25 1
      journal/database/info.php

+ 114 - 0
journal/database/cate.php

@@ -0,0 +1,114 @@
+<?php
+
+return array
+(
+    # 表名
+    'name' => 'cate',
+    # 显示给用户看的名称
+    'lang' => '小刊分类设置',
+    # 后台菜单排序
+    'order' => 9,
+    # 数据结构
+    '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,
+        ),
+        
+        'reorder'       => array
+        (
+            'type'      => 'int-11',
+            'name'      => '排序(数值越大越靠前)',
+            'default'   => '1',
+            'desc'      => '请输入排序',
+            'match'     => 'option',
+            'update'    => 'text',
+            'search'    => 'order',
+            'list'      => true,
+            'order'     => 'desc',
+            'edit'      => true,
+        ),
+
+        '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})',
+        ),
+    ),
+
+    # 默认值
+    'default' => array
+    (
+        'col' => 'name,state,cdate',
+        'value' => array
+        (
+            '"默认分类",1,' . time(),
+        ),
+    ),
+
+    'manage' => array
+    (
+        'insert' => false,
+        'edit' => false,
+
+        # 自定义快捷新增和编辑
+        'button' => array
+        (
+            '新增' => array('fast'),
+        ),
+        # 快捷更新
+        'list_button' => array
+        (
+            'edit' => array('编辑'),
+        ),
+    ),
+
+    'request' => array
+    (
+        'getAll' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'state' => 1,
+            ),
+            'type' => 'all',
+            'order' => array('reorder' => 'desc','id' => 'desc'),
+            'col' => '*',
+        ),
+    ),
+);

+ 25 - 1
journal/database/info.php

@@ -15,6 +15,18 @@ $share = function()
 	return $array;
 };
 
+$cate = function()
+{
+	$array = array();
+	$info = Dever::db('journal/cate')->state();
+	if($info)
+	{
+		$array += $info;
+	}
+	return $array;
+};
+
+
 $share = array
 (
 	1 => '显示',
@@ -30,7 +42,7 @@ $buy = array
 $page = 15;
 
 # 常用的col
-$col = 'id,name,subname,pic_cover,pic_view_cover,pic_view_bg,pdate,num_add_view+num_view as num_view,num_ding+num_add_ding as num_ding,num_comment,buy,share_yes,share_title,share_pic,share_content,pic_gd';
+$col = 'id,name,subname,pic_cover,pic_view_cover,pic_view_bg,pdate,num_add_view+num_view as num_view,num_ding+num_add_ding as num_ding,num_comment,buy,share_yes,share_title,share_pic,share_content,pic_gd,cate_id';
 
 return array
 (
@@ -89,6 +101,18 @@ return array
 			//'list'		=> true,
 		),
 
+		'cate_id'		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> '小刊分类',
+			'default' 	=> '1',
+			'desc' 		=> '小刊分类',
+			'match' 	=> 'is_numeric',
+			'update'	=> 'select',
+			'option'	=> $cate,
+			'search'	=> 'select',
+		),
+
   		'pic_cover'		=> array
 		(
 			'type' 		=> 'varchar-150',