123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283 |
- <?php
- # 定义几个常用的选项
- $option = array
- (
- 1 => '可用',
- 2 => '不可用',
- );
- $fast = array
- (
- 1 => '是',
- 2 => '否',
- );
- $type = array
- (
- 1 => '开启',
- 2 => '不开启',
- );
- # 图标
- $icon = array
- (
- 1 => '默认',
- );
- $menu = function()
- {
- $array = array(-1 => array('name' => '父级菜单'));
- $menu = Dever::load('manage/menu-get');
- if($menu)
- {
- $array += $menu;
- }
- return $array;
- };
- return array
- (
- # 表名
- 'name' => 'menu',
- # 显示给用户看的名称
- 'lang' => '管理菜单设置',
- 'order' => 2,
- # 不允许key重复
- 'start' => array
- (
- 'update' => 'manage/menu.checkKey',
- 'insert' => 'manage/menu.checkKey',
- ),
- # 数据结构
- 'struct' => array
- (
- 'id' => array
- (
- 'type' => 'int-11',
- 'name' => '菜单ID',
- 'default' => '',
- 'desc' => '',
- 'match' => 'is_numeric',
- 'order' => 'desc',
- ),
-
- 'name' => array
- (
- 'type' => 'varchar-50',
- 'name' => '菜单名称',
- 'default' => '',
- 'desc' => '请输入菜单名称',
- 'match' => 'is_string',
- 'update' => 'text',
- 'search' => 'order,fulltext',
- 'list' => true,
- ),
-
- 'menu_id' => array
- (
- 'type' => 'int-11',
- 'name' => '上级菜单',
- 'default' => -1,
- 'desc' => '请选择上级菜单',
- 'match' => 'is_numeric',
- 'update' => 'select',
- 'search' => 'order,select',
- 'list' => '{menu_id} > 0 ? Dever::load("manage/menu-one#name", {menu_id}) : "父级菜单"',
- 'option' => $menu,
- ),
-
- 'key' => array
- (
- 'type' => 'varchar-100',
- 'name' => '菜单唯一key',
- 'default' => '',
- 'desc' => '请输入菜单唯一key',
- 'match' => 'option',
- 'update' => 'text',
- 'search' => 'fulltext',
- 'list' => true,
- ),
- 'link' => array
- (
- 'type' => 'varchar-150',
- '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,
- ),
-
- 'type' => array
- (
- 'type' => 'tinyint-1',
- 'name' => '开启子菜单',
- 'default' => '2',
- 'desc' => '请选择开启子菜单',
- 'match' => 'is_numeric',
- 'option' => $type,
- 'update' => 'radio',
- 'list' => true,
- ),
- 'icon' => array
- (
- 'type' => 'varchar-100',
- 'name' => '图标代码-请<a href="http://dwz.cn/1j8SP0" target="_blank">点此</a>查看图标代码',
- 'default' => 'glyphicon glyphicon-folder-close',
- 'desc' => '请输入图标代码',
- 'match' => 'is_string',
- //'option' => $icon,
- 'update' => 'text',
- ),
-
- 'fast' => array
- (
- 'type' => 'tinyint-1',
- 'name' => '是否快捷菜单',
- 'default' => '2',
- 'desc' => '请选择快捷菜单',
- 'match' => 'is_numeric',
- 'option' => $fast,
- 'update' => 'radio',
- 'list' => true,
- 'edit' => true,
- ),
- 'state' => array
- (
- 'type' => 'tinyint-1',
- 'name' => '状态',
- 'default' => '1',
- 'desc' => '请选择状态',
- 'match' => array('is_numeric', 1),
- 'option' => $option,
- 'update' => 'radio',
- 'list' => true,
- ),
-
- '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
- (
- 'list_button' => array(6 => '删除'),
- 'button' => array
- (
- '更新菜单' => 'manage/menu.update',
- //'全部清空' => 'manage/menu.delete',
- )
- ),
-
- # request 请求接口定义
- 'request' => array
- (
- # info 取一条正常的数据
- 'info' => array
- (
- 'where' => array
- (
- 'id' => 'is_numeric',
- 'state' => 1,
- ),
- 'type' => 'one',
- ),
-
- 'key' => array
- (
- 'where' => array
- (
- 'key' => 'yes',
- ),
- 'type' => 'one',
- ),
-
- 'keyId' => array
- (
- 'where' => array
- (
- 'key' => 'yes',
- 'id' => array('yes', '!='),
- ),
- 'type' => 'one',
- ),
-
- # 取所有菜单
- 'all' => array
- (
- 'type' => 'all',
- 'order' => array('reorder` desc,`id', 'desc'),
- 'col' => '*|id',
- ),
- # main 取所有子菜单
- 'child' => array
- (
- 'where' => array
- (
- 'state' => 1,
- 'menu_id' => array(1, '>='),
- ),
- 'type' => 'all',
- 'order' => array('reorder` desc,`id', 'desc'),
- 'col' => '*|menu_id|key|',
- ),
-
- # main 取所有一级菜单
- 'main' => array
- (
- 'where' => array
- (
- 'state' => 1,
- 'menu_id' => -1,
- ),
- 'option' => array
- (
- 'key' => array('yes', 'in'),
- ),
- 'type' => 'all',
- 'order' => array('reorder` desc,`id', 'desc'),
- 'col' => '*|key',
- ),
-
- # main 取所有一级菜单
- 'get' => array
- (
- 'where' => array
- (
- 'state' => 1,
- 'menu_id' => -1,
- ),
- 'type' => 'all',
- 'order' => array('reorder` desc,`id', 'desc'),
- 'col' => '*|id',
- ),
- ),
- );
|