<?php
/**
 * tester
 */

$template = function()
{
	$array = array();
	$info = Dever::load('component_applet/template-state');
	if($info)
	{
		$array += $info;
	}
	return $array;
};


return array
(
	# 表名
	'name' => 'page',
	# 显示给用户看的名称
	'lang' => '页面列表',
	'order' => 93,
	# 数据结构
	'struct' => array
	(
		'id' 		=> array
		(
			'type' 		=> 'int-11',
			'name' 		=> 'ID',
			'default' 	=> '',
			'desc' 		=> '',
			'match' 	=> 'is_numeric',
			'search'	=> 'order',
			'list'		=> true,
		),

		'project_id'		=> array
		(
			'type' 		=> 'int-11',
			'name' 		=> '项目',
			'default' 	=> '',
			'desc' 		=> '请输入项目',
			'match' 	=> 'is_numeric',
		),
		
		'name'		=> array
		(
			'type' 		=> 'varchar-60',
			'name' 		=> '页面名',
			'default' 	=> '',
			'desc' 		=> '页面名',
			'match' 	=> 'is_string',
			'update'	=> 'text',
			'list'		=> true,
		),

		'template_id'		=> array
		(
			'type' 		=> 'varchar-500',
			'name' 		=> '小程序模板',
			'default' 	=> '',
			'desc' 		=> '小程序模板',
			'match' 	=> 'is_string',
			'update'	=> 'checkbox',
			'search'	=> 'select',
			'option'	=> $template,
			'list'		=> true,
		),

		'pagepath'		=> array
		(
			'type' 		=> 'varchar-60',
			'name' 		=> '页面路径',
			'default' 	=> '',
			'desc' 		=> '页面路径',
			'match' 	=> 'is_string',
			'update'	=> 'text',
			'list'		=> 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,
		),
	),

	# 更新表结构
	'alter' => array
	(
		2 => array
		(
			array('update', 'template_id', 'template_id', 'varchar-500 1 小程序模板'),
			//array('add', 'config', 'config', 'int-11 1 配置'),
		),
		'version' => 2,
	),

	'top' => Dever::config('base', 'component')->top,

	'manage' => array
	(
		
	),

	# request 请求接口定义
	'request' => array
	(
		'getAll' => array
		(
			# 匹配的正则或函数 选填项
			'option' => array
			(
				'template_id' => array('yes', 'like'),
				'state' => 1,
			),
			'type' => 'all',
			'order' => array('reorder' => 'desc', 'cdate' => 'desc'),
			'col' => '*',
		),

		'getOne' => array
		(
			# 匹配的正则或函数 选填项
			'option' => array
			(
				'template_id' => array('yes', 'like'),
				'state' => 1,
			),
			'type' => 'one',
			'order' => array('reorder' => 'desc', 'cdate' => 'desc'),
		),
	)
);