<?php

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

return array
(
	# 表名
	'name' => 'user',
	# 显示给用户看的名称
	'lang' => '渠道用户',
	'order' => 10,
	'menu'	=> false,
	# 数据结构
	'struct' => array
	(
		'id' 		=> array
		(
			'type' 		=> 'int-11',
			'name' 		=> 'ID',
			'default' 	=> '',
			'desc' 		=> '',
			'match' 	=> 'is_numeric',
		),
		
		'vid'		=> array
		(
			'type' 		=> 'int-11',
			'name' 		=> '第三方ID',
			'default' 	=> '',
			'desc' 		=> '第三方id',
			'match' 	=> 'is_numeric',
			'update'	=> 'text',
			'list'		=> true,
		),

		'uid'		=> array
		(
			'type' 		=> 'int-11',
			'name' 		=> '用户ID',
			'default' 	=> '',
			'desc' 		=> '用户id',
			'match' 	=> 'is_numeric',
			'update'	=> 'text',
			'list'		=> true,
		),

		'source_id'		=> array
		(
			'type' 		=> 'int-11',
			'name' 		=> '渠道',
			'default' 	=> '',
			'desc' 		=> '渠道',
			'match' 	=> 'is_numeric',
			'update'	=> 'text',
			'option'	=> $source,
			'search'	=> 'select',
			'list'		=> true,
		),

		'account_type'		=> array
		(
			'type' 		=> 'varchar-100',
			'name' 		=> '账户类型',
			'default' 	=> '',
			'desc' 		=> 'account_type',
			'match' 	=> 'is_string',
			'update'	=> 'text',
			'list'		=> true,
		),

		'account_id'		=> array
		(
			'type' 		=> 'int-11',
			'name' 		=> '账户ID',
			'default' 	=> '',
			'desc' 		=> 'account_id',
			'match' 	=> 'is_numeric',
			'update'	=> 'text',
			'list'		=> 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,
		),
	),

	'manage' => array
	(
		'delete' => false,
		'edit' => false,
		//'insert' => false,
	),

	# request 请求接口定义
	'request' => array
	(
		'getTotal' => array
		(
			# 匹配的正则或函数 选填项
			'option' => array
			(
				'source_id' => 'yes',
				'start' => array('yes-cdate', '>='),
				'end' => array('yes-cdate', '<='),
				'state' => 1,
			),
			'type' => 'count',
		),
	),
);