| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224 | <?php$action = function(){	$array = array();	$info = Dever::db('score/action')->state();	if($info)	{		$array += $info;	}	return $array;};$score_type = array(	1 => '未加积分',	2 => '已加积分',	3 => '达到积分上限',);$cron_type = array(	1 => '未开始',	2 => '进行中',	3 => '已完成',);return array(	# 表名	'name' => 'action_log',	# 显示给用户看的名称	'lang' => '积分行为日志',	'order' => 10,	'menu' => false,	# 数据结构	'struct' => array	(		'id' 		=> array		(			'type' 		=> 'int-11',			'name' 		=> 'ID',			'default' 	=> '',			'desc' 		=> '',			'match' 	=> 'is_numeric',			'list'		=> true,		),		'uid'		=> array		(			'type' 		=> 'int-11',			'name' 		=> '用户名',			'default' 	=> '0',			'desc' 		=> '请选择用户',			'match' 	=> 'is_numeric',			//'update'	=> 'select',			//'search'	=> 'select',			'search'    => array            (                'api' => 'passport/user-all',                'col' => 'username',                'result' => 'id',            ),			'list'		=> '{uid} > 0 ? Dever::load("passport/user-one#username", {uid}) : "匿名用户"',		),		'parent_uid'		=> array		(			'type' 		=> 'int-11',			'name' 		=> '上级用户',			'default' 	=> '0',			'desc' 		=> '请选择上级用户',			'match' 	=> 'is_numeric',			'list'		=> true,		),				'action_id'		=> array		(			'type' 		=> 'int-11',			'name' 		=> '所属行为',			'default' 	=> '1',			'desc' 		=> '所属行为',			'match' 	=> 'is_numeric',			'update'	=> 'select',			'option'	=> $action,			'search'	=> 'select',			'list'		=> true,		),		'type' 		=> array		(			'type' 		=> 'varchar-32',			'name' 		=> '所属数据源',			'default' 	=> '',			'desc' 		=> '所属数据源',			'match' 	=> 'is_string',			'list'		=> true,		),				'type_id' 		=> array		(			'type' 		=> 'int-11',			'name' 		=> '数据源id',			'default' 	=> '',			'desc' 		=> '数据源id',			'match' 	=> 'is_numeric',			'list'		=> true,		),		'score_type'		=> array		(			'type' 		=> 'int-11',			'name' 		=> '是否增加积分',			'default' 	=> '1',			'desc' 		=> '是否增加积分',			'match' 	=> 'is_numeric',			'update'	=> 'select',			'option'	=> $score_type,			//'search'	=> 'select',			//'list'		=> true,		),		'cron_type'		=> array		(			'type' 		=> 'int-11',			'name' 		=> '状态',			'default' 	=> '3',			'desc' 		=> '状态',			'match' 	=> 'is_numeric',			'update'	=> 'select',			'option'	=> $cron_type,			//'search'	=> 'select',			//'list'		=> true,		),		'score'		=> array		(			'type' 		=> 'varchar-30',			'name' 		=> '增加积分数',			'default' 	=> '0',			'desc' 		=> '积分数',			'match' 	=> 'is_string',			//'list'		=> true,		),		'num'		=> array		(			'type' 		=> 'varchar-30',			'name' 		=> '增加的积分将乘以该数量',			'default' 	=> '0',			'desc' 		=> '积分数',			'match' 	=> 'is_string',		),		'mscore'		=> array		(			'type' 		=> 'varchar-30',			'name' 		=> '手动增加积分数',			'default' 	=> '0',			'desc' 		=> '积分数',			'match' 	=> 'is_string',		),		'callback'		=> array		(			'type' 		=> 'varchar-800',			'name' 		=> '行为回调方法',			'default' 	=> '',			'desc' 		=> '行为回调方法',			'match' 	=> 'option',			'update'	=> 'textarea',			//'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})',		),	),	# 索引	'index' => array	(		1 => array		(			'search' => 'uid,action_id,cron_type',		),				# 版本号 更改版本号会更新当前表的索引		'version' => 1,	),	'manage' => array	(		'delete' => false,		'edit' => false,		'insert' => false,	),	# request 请求接口定义	'request' => array	(		'getDataByDate' => array		(			# 匹配的正则或函数 选填项			'option' => array			(				'start' => array('yes-cdate', '>='),				'end' => array('yes-cdate', '<='),				'score_type' => 'yes',				'action_id' => 'yes',			),			'type' => 'all',			'order' => array('id' => 'desc'),			'col' => 'id',		),	));
 |