| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237 | <?php# 定义几个常用的选项$option = array(	1 => '显示',	2 => '不显示',);$status = array(	1 => '未读',	2 => '已读',);$message_type = Dever::db('message/type');$type = function() use($message_type){	return $message_type->state();};$scope = $message_type->config['config_scope'];$project = function(){	return Dever::load('message/project-state');};return array(	# 表名	'name' => 'inbox',	# 显示给用户看的名称	'lang' => '收件箱',	'order' => 18,	# 数据结构	'struct' => array	(		'id' 		=> array		(			'type' 		=> 'int-11',			'name' 		=> 'ID',			'default' 	=> '',			'desc' 		=> '',			'match' 	=> 'is_numeric',			'order'		=> 'desc',			//'list'		=> true,		),		'oid'		=> array		(			'type' 		=> 'int-11',			'name' 		=> '收件id',			'default' 	=> '',			'desc' 		=> '请填写收件id',			'match' 	=> 'is_numeric',			'update'	=> 'text',			'list'		=> true,		),		'uid'		=> array		(			'type' 		=> 'int-11',			'name' 		=> '收件人',			'default' 	=> '',			'desc' 		=> '请填写收件人',			'match' 	=> 'is_numeric',			'update'	=> 'text',			'list'		=> true,		),		'from_uid'		=> array		(			'type' 		=> 'int-11',			'name' 		=> '发件人',			'default' 	=> '',			'desc' 		=> '请填写发件人',			'match' 	=> 'is_numeric',			'update'	=> 'text',			'list'		=> '{uid} > 0 ? {uid} : "系统"',		),		'name'		=> array		(			'type' 		=> 'varchar-30',			'name' 		=> '发件标题',			'default' 	=> '',			'desc' 		=> '请填写发件标题',			'match' 	=> 'is_string',			'update'	=> 'text',			'search'	=> 'fulltext',			'list'		=> true,		),		'content'		=> array		(			'type' 		=> 'text-255',			'name' 		=> '发件内容',			'default' 	=> '',			'desc' 		=> '请填写发件内容',			'match' 	=> 'is_string',			'update'	=> 'textarea',			'search'	=> 'fulltext',			'list'		=> true,		),		'project_id'		=> array		(			'type' 		=> 'int-11',			'name' 		=> '所属项目',			'default' 	=> '1',			'desc' 		=> '所属项目',			'match' 	=> 'is_numeric',			'option' 	=> $project,			'update'	=> 'select',			//'search'	=> 'select',			'list'		=> true,		),		'type'		=> array		(			'type' 		=> 'int-11',			'name' 		=> '消息类型',			'default' 	=> '1',			'desc' 		=> '消息类型',			'match' 	=> 'is_numeric',			'option' 	=> $type,			'update'	=> 'select',			//'search'	=> 'select',			'list'		=> true,		),		'scope'		=> array		(			'type' 		=> 'tinyint-1',			'name' 		=> '消息范围',			'default' 	=> '1',			'desc' 		=> '消息范围',			'match' 	=> 'is_numeric',			'option' 	=> $scope,			'update'	=> 'radio',			'search'	=> 'select',			'list'		=> true,		),		'param'		=> array		(			'type' 		=> 'varchar-800',			'name' 		=> '传入参数-一般为json格式数据',			'default' 	=> '',			'desc' 		=> '传入参数',			'match' 	=> 'is_string',		),		'status'		=> array		(			'type' 		=> 'tinyint-1',			'name' 		=> '已读状态',			'default' 	=> '1',			'desc' 		=> '请选择状态',			'match' 	=> 'is_numeric',			'option' 	=> $status,			'update'	=> 'radio',			'search'	=> 'select',			'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})',		),	),	'manage' => array	(	),	# request 请求接口定义	'request' => array	(		# 获取列表页		'getAll' => array		(			# 匹配的正则或函数 选填项			'option' => array			(				//'name' => array('yes', 'like'),				'uid' => 'yes',				'project_id' => 'yes',				'status' => 'yes',				'state' => 1,			),			'type' => 'all',			'page' => array(15, 'list'),			'order' => array('id' => 'desc'),			'col' => '*',		),		# 获取未读消息		'getInfo' => array		(			# 匹配的正则或函数 选填项			'where' => array			(				'project_id' => 'yes',				'uid' => 'yes',				'status' => 'yes',				'type' => 'yes'			),			'type' => 'all',			'order' => array('id' => 'desc'),			'col' => '*',		),	),	'manage' => array	(		'edit' => false,		'insert' => false,		'mul' => true,	),);
 |