dever %!s(int64=7) %!d(string=hai) anos
achega
44a201343c
Modificáronse 4 ficheiros con 240 adicións e 0 borrados
  1. 95 0
      database/cate.php
  2. 109 0
      database/info.php
  3. 8 0
      index.php
  4. 28 0
      src/Api.php

+ 95 - 0
database/cate.php

@@ -0,0 +1,95 @@
+<?php
+
+return array
+(
+	# 表名
+	'name' => 'cate',
+	# 显示给用户看的名称
+	'lang' => '分类管理',
+	# 是否显示在后台菜单
+	'order' => 9,
+
+	# 数据结构
+	'struct' => array
+	(
+		'id' 		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> 'ID',
+			'default' 	=> '',
+			'desc' 		=> '',
+			'match' 	=> 'is_numeric',
+			'order'		=> 'asc',
+			'list'		=> true,
+		),
+
+		'name'		=> array
+		(
+			'type' 		=> 'varchar-150',
+			'name' 		=> '分类名称',
+			'default' 	=> '',
+			'desc' 		=> '分类名称',
+			'match' 	=> 'is_string',
+			'update'	=> 'text',
+			'search'	=> 'fulltext',
+			'list'		=> true,
+			'edit'		=> 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',
+			'name' 		=> '状态',
+			'default' 	=> '1',
+			'desc' 		=> '请选择状态',
+			'match' 	=> 'is_numeric',
+		),
+		
+		'cdate'		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> '录入时间',
+			'match' 	=> array('is_numeric', time()),
+			'desc' 		=> '',
+			# 只有insert时才生效
+			'insert'	=> true,
+			'search'	=> 'date',
+			'list'		=> 'date("Y-m-d H:i:s", {cdate})',
+		),
+	),
+
+	'manage' => array
+	(
+
+	),
+
+	# 默认值
+	'default' => array
+	(
+		'col' => 'name,state,cdate',
+		'value' => array
+		(
+			'"默认分类",1,' . time(),
+		),
+	),
+
+	'request' => array
+	(
+		
+	)
+);

+ 109 - 0
database/info.php

@@ -0,0 +1,109 @@
+<?php
+
+$cate = function()
+{
+	$array = array();
+	$info = Dever::load('attr/cate-state');
+	if($info)
+	{
+		$array += $info;
+	}
+	return $array;
+};
+
+return array
+(
+	# 表名
+	'name' => 'info',
+	# 显示给用户看的名称
+	'lang' => '属性列表',
+	# 是否显示在后台菜单
+	'order' => 10,
+
+	# 数据结构
+	'struct' => array
+	(
+		'id' 		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> 'ID',
+			'default' 	=> '',
+			'desc' 		=> '',
+			'match' 	=> 'is_numeric',
+			'order'		=> 'asc',
+			'list'		=> true,
+		),
+
+		'name'		=> array
+		(
+			'type' 		=> 'varchar-150',
+			'name' 		=> '属性名称',
+			'default' 	=> '',
+			'desc' 		=> '属性名称',
+			'match' 	=> 'is_string',
+			'update'	=> 'text',
+			'search'	=> 'fulltext',
+			'list'		=> true,
+			'edit'		=> true,
+		),
+
+		'cate_id'		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> '选择分类',
+			'default' 	=> '1',
+			'desc' 		=> '选择分类',
+			'match' 	=> 'is_numeric',
+			'update'	=> 'select',
+			'option'	=> $cate,
+			'list'		=> '{cate_id} > 0 ? Dever::load("attr/cate-one#name", {cate_id}) : "未选择"',
+		),
+
+		'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',
+			'name' 		=> '状态',
+			'default' 	=> '1',
+			'desc' 		=> '请选择状态',
+			'match' 	=> 'is_numeric',
+		),
+		
+		'cdate'		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> '录入时间',
+			'match' 	=> array('is_numeric', time()),
+			'desc' 		=> '',
+			# 只有insert时才生效
+			'insert'	=> true,
+			'search'	=> 'date',
+			'list'		=> 'date("Y-m-d H:i:s", {cdate})',
+		),
+	),
+
+	'manage' => array
+	(
+		# 列表页的类型
+		
+	),
+
+	'request' => array
+	(
+		
+	)
+);

+ 8 - 0
index.php

@@ -0,0 +1,8 @@
+<?php
+
+define('DEVER_APP_NAME', 'attr');
+define('DEVER_APP_LANG', '属性管理');
+define('DEVER_APP_PATH', dirname(__FILE__) . DIRECTORY_SEPARATOR);
+define('DEVER_MANAGE_ORDER', 10);
+define('DEVER_MANAGE_ICON', 'glyphicon glyphicon-hdd');
+include(DEVER_APP_PATH . '../boot.php');

+ 28 - 0
src/Api.php

@@ -0,0 +1,28 @@
+<?php
+
+namespace Attr\Src;
+
+use Dever;
+
+class Api
+{
+	/**
+	 * 获取属性配置
+	 *
+	 * @return mixed
+	 */
+	public function get()
+	{
+		$cate = Dever::db('attr/cate')->state();
+
+		if ($cate) {
+			foreach ($cate as $k => $v) {
+				$cate[$k]['child'] = Dever::db('attr/info')->state(array('cate_id' => $v['id']));
+			}
+		}
+
+		$cate['state'] = 1;
+
+		return $cate;
+	}
+}