<?php

$link = function()
{
	$array = array();
	$info = Dever::db('source/link')->state();
	if($info)
	{
		$array += $info;
	}
	return $array;
};

return array
(
	# 表名
	'name' => 'info',
	# 显示给用户看的名称
	'lang' => '渠道管理',
	'order' => 10,
	# 数据结构
	'struct' => array
	(
		'id' 		=> array
		(
			'type' 		=> 'int-11',
			'name' 		=> 'ID',
			'default' 	=> '',
			'desc' 		=> '',
			'match' 	=> 'is_numeric',
		),
		
		'name'		=> array
		(
			'type' 		=> 'varchar-80',
			'name' 		=> '名称',
			'default' 	=> '',
			'desc' 		=> '请输入名称',
			'match' 	=> 'is_string',
			'update'	=> 'text',
			'search'	=> 'fulltext',
			'list'		=> true,
		),

		'link_id'		=> array
		(
			'type' 		=> 'int-11',
			'name' 		=> '推广链接',
			'default' 	=> '1',
			'desc' 		=> '推广链接',
			'match' 	=> 'is_numeric',
			'update'	=> 'select',
			'option'	=> $link,
			'search'	=> 'select',
			'list'		=> true,
		),

		'code'		=> array
		(
			'type' 		=> 'varchar-200',
			'name' 		=> '渠道二维码',
			'default' 	=> '',
			'desc' 		=> '渠道二维码',
			'match' 	=> 'is_string',
			'update'	=> 'textarea',
			'list'		=> 'Dever::load("source/lib/manage.show", "{id}")',
		),

		'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,
		),
	),

	'manage' => array
	(
		'delete' => false,
		'edit' => false,
		# 列表
		'list_button' => array
		(
			'list' => array('渠道统计', '"stat&search_option_info_id={id}&oper_parent=info"'),
		),
	),
);