| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382 | <?php$cate = function(){	$array = array();	$info = Dever::db('task/cate')->state();	if($info)	{		$array += $info;	}	return $array;};$level = function(){	$array = array();	$info = Dever::db('task/level')->state();	if($info)	{		$array += $info;	}	return $array;};$company = function(){	$array = array();	$info = Dever::db('task/company')->state();	if($info)	{		$array += $info;	}	return $array;};$demand = array(	'username' => '账号名',	'pic' => '截图',	'link' => '链接',	'desc' => '文字说明',);$status = array(	1 => '进行中',	2 => '未开始',	3 => '已结束',);return array(	# 表名	'name' => 'info',	# 显示给用户看的名称	'lang' => '任务管理',	'desc' => '可将lib/cron.task加入到计划任务,建议间隔时间为86400,每天凌晨执行,将自动清理过期的任务',	'order' => 200,	# 更新后,要把company_id等信息同步给user_task,方便统计	'sync' => array	(		'task/user_task' => array		(			# 更新另外一个表的字段 => 本表的字段			'where' => array('task_id', 'id'),			# 要更新的数据			'update' => array(				'company_id' => 'company_id',				'level_id' => 'level_id',				'cate_id' => 'cate_id',			),			# 同步更新的类型,delete为先删再插入,update为先查询是否存在,存在直接更新,不存在则插入, only为仅更新			'type' => 'only',		)	),	# 数据结构	'struct' => array	(		'id' 		=> array		(			'type' 		=> 'int-11',			'name' 		=> 'ID',			'default' 	=> '',			'desc' 		=> '',			'match' 	=> 'is_numeric',			//'search'	=> 'order',			'order'		=> 'desc',			'list'		=> true,		),		'hr1'		=> array		(			'name' 		=> '基本设置',			'class'		=> '',//本项必须填写			'attr'		=> '',		),		'name'		=> array		(			'type' 		=> 'varchar-60',			'name' 		=> '任务标题',			'default' 	=> '',			'desc' 		=> '任务标题',			'match' 	=> 'is_string',			'update'	=> 'text',			'search'	=> 'fulltext',			'list'		=> true,		),		'sdate'		=> array		(			'type' 		=> 'int-11',			'name' 		=> '开始日',			'match' 	=> 'is_numeric',			'desc' 		=> '开始时间',			'update'	=> 'time',			//'list'		=> 'date("Y-m-d H:i:s", {sdate})',			'callback'	=> 'maketime',			'list_name'	=> '时间',			'list' => 'date("Y-m-d", {sdate})."~".date("Y-m-d", {edate})'		),		'edate'		=> array		(			'type' 		=> 'int-11',			'name' 		=> '结束日',			'match' 	=> 'is_numeric',			'desc' 		=> '结束日',			'update'	=> 'time',			//'list'		=> 'date("Y-m-d H:i:s", {edate})',			'callback'	=> 'maketime',		),		'company_id'		=> array		(			'type' 		=> 'int-11',			'name' 		=> '所属商家',			'default' 	=> '',			'desc' 		=> '所属商家',			'match' 	=> 'is_numeric',			'update'	=> 'select',			'search'	=> 'select',			'option'	=> $company,			'list'		=> true,		),		'level_id'		=> array		(			'type' 		=> 'int-11',			'name' 		=> '任务级别',			'default' 	=> '',			'desc' 		=> '任务级别',			'match' 	=> 'is_numeric',			'update'	=> 'select',			'search'	=> 'select',			'option'	=> $level,			'list'		=> true,		),		'cate_id'		=> array		(			'type' 		=> 'int-11',			'name' 		=> '任务类别',			'default' 	=> '',			'desc' 		=> '任务类别',			'match' 	=> 'is_numeric',			'update'	=> 'radio',			'search'	=> 'select',			'option'	=> $cate,			'list'		=> true,		),		'hr2'		=> array		(			'name' 		=> '任务限制',			'class'		=> '',//本项必须填写			'attr'		=> '',		),		'num'		=> array		(			'type' 		=> 'int-11',			'name' 		=> '任务领取总人数',			'default' 	=> '0',			'match' 	=> '任务领取总人数',			'match' 	=> 'is_numeric',			'update'	=> 'text',			//'list'		=> true,		),		'cate_num'		=> array		(			'type' 		=> 'int-11',			'name' 		=> '同一类别参与次数',			'default' 	=> '0',			'match' 	=> '同一类别参与次数',			'match' 	=> 'option',			'update'	=> 'text',			//'list'		=> true,		),		'company_num'		=> array		(			'type' 		=> 'int-11',			'name' 		=> '同一商家参与次数',			'default' 	=> '0',			'match' 	=> '同一商家参与次数',			'match' 	=> 'option',			'update'	=> 'text',			//'list'		=> true,		),		'report_num'		=> array		(			'type' 		=> 'int-11',			'name' 		=> '报告数量上限',			'default' 	=> '0',			'match' 	=> '报告数量上限',			'match' 	=> 'is_numeric',			'update'	=> 'text',			//'list'		=> true,		),		'report_user_num'		=> array		(			'type' 		=> 'int-11',			'name' 		=> '人均报告数量',			'default' 	=> '0',			'match' 	=> '人均报告数量',			'match' 	=> 'is_numeric',			'update'	=> 'text',			//'list'		=> true,		),		'hr3'		=> array		(			'name' 		=> '任务酬劳',			'class'		=> '',//本项必须填写			'attr'		=> '',		),		'score'		=> array		(			'type' 		=> 'int-11',			'name' 		=> '单任务报告酬劳',			'default' 	=> '0',			'match' 	=> '单任务报告酬劳',			'match' 	=> 'is_numeric',			'update'	=> 'text',			//'list'		=> true,		),		'group_score'		=> array		(			'type' 		=> 'int-11',			'name' 		=> '下线提成酬劳',			'default' 	=> '0',			'match' 	=> '下线提成酬劳',			'match' 	=> 'is_numeric',			'update'	=> 'text',			//'list'		=> true,		),		'hr4'		=> array		(			'name' 		=> '其他设置',			'class'		=> '',//本项必须填写			'attr'		=> '',		),		'report_demand'		=> array		(			'type' 		=> 'varchar-50',			'name' 		=> '报告要求',			'default' 	=> 'username',			'desc' 		=> '状态',			'match' 	=> 'option',			'update'	=> 'checkbox',			'option'	=> $demand,			//'list'		=> true,		),		'content'		=> array		(			'type' 		=> 'text-255',			'name' 		=> '任务说明',			'default' 	=> '',			'desc' 		=> '任务说明',			'match' 	=> 'option',			'update'	=> 'editor',		),		'status'		=> array		(			'type' 		=> 'tinyint-1',			'name' 		=> '状态',			'default' 	=> '1',			'desc' 		=> '状态',			'match' 	=> 'is_numeric',			'update'	=> 'select',			'option'	=> $status,			'search'	=> 'select',			'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	(			),	'request' => array	(		'getAll' => array		(			# 匹配的正则或函数 选填项			'option' => array			(				'company_id' => 'yes',				'level_id' => 'yes',				'cate_id' => 'yes',				'end' => array('yes-edate', '<'),				'status' => 1,				'state' => 1,			),			'type' => 'all',			'order' => array('reorder' => 'desc', 'edate' => 'asc'),			'page' => array(15, 'list'),			'col' => '*',		),		'gets' => array		(			# 匹配的正则或函数 选填项			'option' => array			(				'state' => 1,			),			'type' => 'all',			'order' => array('reorder' => 'desc', 'edate' => 'asc'),			'col' => '*',		),	));
 |