| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169 | <?php# 定义几个常用的选项$option = array(	1 => '生效',	2 => '失效',);return array(	# 表名	'name' => 'top',	# 显示给用户看的名称	'lang' => '头部菜单设置',	'menu' => false,	# 数据结构	'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,		),				'top_id'		=> array		(			'type' 		=> 'int-11',			'name' 		=> '上级权限',			'default' 	=> -1,			'desc' 		=> '请选择上级权限',			'match' 	=> 'is_numeric',			'update'	=> 'select',			'search'	=> 'order,select',			'list'		=> '{top_id} > 0 ? Dever::load("manage/top-one#name", {top_id}) : "父级权限"',		),				'key'		=> array		(			'type' 		=> 'varchar-100',			'name' 		=> '权限key',			'default' 	=> '',			'desc' 		=> '请输入权限key',			'match' 	=> 'is_string',			'update'	=> 'text',			'search'	=> 'fulltext',			'list'		=> true,		),		'value'		=> array		(			'type' 		=> 'varchar-30',			'name' 		=> '对应的值',			'default' 	=> '',			'desc' 		=> '请输入对应的值',			'match' 	=> 'is_string',			'update'	=> 'text',			'search'	=> 'fulltext',			'list'		=> 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})',		),	),		# request 请求接口定义	'request' => array	(		'key' => array		(			'where' => array			(				'key' => 'yes',			),			'type' => 'one',		),		'getOne' => array		(			'where' => array			(				'top_id' => 'yes',			),			'type' => 'one',			'order' => array('id', 'desc'),		),		'getData' => array		(			'where' => array			(				'ids' => array('yes-id', 'in'),				'state' => 1,			),			'type' => 'all',			'order' => array('id', 'desc'),			'col' => '*',		),				'keyId' => array		(			'where' => array			(				'key' => 'yes',				'id' => array('yes', '!='),			),			'type' => 'one',		),		# main 取所有子权限		'child' => array		(			'where' => array			(				'state' => 1,				'top_id' => array(1, '>='),			),			'type' => 'all',			'order' => array('id', 'desc'),			'col' => '*|top_id|key|',		),				# main 取所有一级权限		'main' => array		(			'where' => array			(				'state' => 1,				'top_id' => -1,			),			'type' => 'all',			'order' => array('id', 'desc'),			'col' => '*|key',		),	),);
 |