| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195 | 
							- <?php
 
- $cate = function()
 
- {
 
- 	$array = array();
 
- 	$cate = Dever::load('question/cate-state');
 
- 	if($cate)
 
- 	{
 
- 		$array += $cate;
 
- 	}
 
- 	return $array;
 
- };
 
- $level = function()
 
- {
 
- 	$array = array();
 
- 	$cate = Dever::load('question/level-state');
 
- 	if($cate)
 
- 	{
 
- 		$array += $cate;
 
- 	}
 
- 	return $array;
 
- };
 
- return array
 
- (
 
- 	# 表名
 
- 	'name' => 'info',
 
- 	# 显示给用户看的名称
 
- 	'lang' => '题库列表',
 
- 	# 是否显示在后台菜单
 
- 	'order' => 100,
 
- 	# 数据结构
 
- 	'struct' => array
 
- 	(
 
- 		'id' 		=> array
 
- 		(
 
- 			'type' 		=> 'int-11',
 
- 			'name' 		=> 'ID',
 
- 			'default' 	=> '',
 
- 			'desc' 		=> '',
 
- 			'match' 	=> 'is_numeric',
 
- 			'order'		=> 'desc',
 
- 			'list'		=> true,
 
- 		),
 
- 		'name'		=> array
 
- 		(
 
- 			'type' 		=> 'varchar-150',
 
- 			'name' 		=> '标题',
 
- 			'default' 	=> '',
 
- 			'desc' 		=> '标题',
 
- 			'match' 	=> 'is_string',
 
- 			'update'	=> 'text',
 
- 			'search'	=> 'fulltext',
 
- 			'list'		=> true,
 
- 		),
 
- 		'level_id'		=> array
 
- 		(
 
- 			'type' 		=> 'int-11',
 
- 			'name' 		=> '难度',
 
- 			'default' 	=> '1',
 
- 			'desc' 		=> '难度',
 
- 			'match' 	=> 'is_numeric',
 
- 			'update'	=> 'select',
 
- 			'option'	=> $level,
 
- 			'search'	=> 'select',
 
- 			'list'		=> '{level_id} > 0 ? Dever::load("question/level-one#name", {level_id}) : "未知"',
 
- 		),
 
- 		'cate_id'		=> array
 
- 		(
 
- 			'type' 		=> 'int-11',
 
- 			'name' 		=> '分类',
 
- 			'default' 	=> '1',
 
- 			'desc' 		=> '请选择分类',
 
- 			'match' 	=> 'is_numeric',
 
- 			'update'	=> 'select',
 
- 			'option'	=> $cate,
 
- 			'search'	=> 'select',
 
- 			//'search_parent' => 'info_id',//根据哪个字段来确定本搜索选项的内容
 
- 			'list'		=> '{cate_id} > 0 ? Dever::load("question/cate-one#name", {cate_id}) : "未知"',
 
- 		),
 
- 		'pic'		=> array
 
- 		(
 
- 			'type' 		=> 'varchar-150',
 
- 			'name' 		=> '背景图',
 
- 			'default' 	=> '',
 
- 			'desc' 		=> '背景图',
 
- 			'match' 	=> 'option',
 
- 			'update'	=> 'image',
 
- 			'key' 		=> '1',
 
- 			'place'		=> '150',
 
- 		),
 
- 		'content'		=> array
 
- 		(
 
- 			'type' 		=> 'text-255',
 
- 			'name' 		=> '选项设置',
 
- 			'default' 	=> '',
 
- 			'desc' 		=> '选项设置',
 
- 			'match' 	=> 'is_string',
 
- 			'update'	=> array
 
- 			(
 
- 				array
 
- 				(
 
- 					'col'		=> 'score',
 
- 					'name' 		=> '选项分数-0为错误选项,大于1则为正确选项',
 
- 					'default' 	=> '0',
 
- 					'desc' 		=> '选项分数',
 
- 					'match' 	=> 'is_string',
 
- 					'update'	=> 'text',
 
- 				),
 
- 				array
 
- 				(
 
- 					'col'		=> 'title',
 
- 					'name' 		=> '选项标题',
 
- 					'default' 	=> '',
 
- 					'desc' 		=> '请输入选项标题',
 
- 					'match' 	=> 'is_string',
 
- 					'update'	=> 'text',
 
- 				),
 
- 				
 
- 				array
 
- 				(
 
- 					'col'		=> 'pic',
 
- 					'name' 		=> '选项图片',
 
- 					'default' 	=> '',
 
- 					'desc' 		=> '选项图片',
 
- 					'match' 	=> 'is_string',
 
- 					'update'	=> 'image',
 
- 					'key' 		=> '1',
 
- 				),
 
- 				array
 
- 				(
 
- 					'col' 		=> 'info',
 
- 					'name' 		=> '描述',
 
- 					'default' 	=> '',
 
- 					'desc' 		=> '请输入描述',
 
- 					'match' 	=> 'is_string',
 
- 					'update'	=> 'textarea',
 
- 				),
 
- 			),
 
- 		),
 
- 		
 
- 		'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
 
- 			(
 
- 				'cate_id' => array('yes', 'in'),
 
- 				'ids' => array('yes', 'in'),
 
- 				'level_id' => 'yes',
 
- 				'state' => 1,
 
- 			),
 
- 			'type' => 'all',
 
- 			'limit' => '0,10000',
 
- 			'col' => '*|id',
 
- 		),
 
- 	)
 
- );
 
 
  |