<?php

$up = array
(
	1 => '是',
	2 => '否',
);

$source_type = array (
	'ios' => 'ios',
	'android' => 'android',
);

$vip = array
(
	1 => '显示',
	2 => '不显示',
);

$button = array
(
	1 => '显示',
	2 => '不显示',
);

$update = array
(
	1 => '显示',
	2 => '不显示',
);

$login = array
(
	1 => '是',
	2 => '否',
);

$anonymous = array
(
	1 => '是',
	2 => '否',
);

return array
(
	# 表名
	'name' => 'version',
	# 显示给用户看的名称
	'lang' => '版本管理',
	# 后台菜单排序
	'order' => 9,
	# 数据结构
	'struct' => array
	(
		'id' 		=> array
		(
			'type' 		=> 'int-11',
			'name' 		=> 'ID',
			'default' 	=> '',
			'desc' 		=> '',
			'match' 	=> 'is_numeric',
			'search'	=> 'order',
			//'list'		=> true,
			'order'		=> 'desc',
		),

		'source_type'		=> array
		(
			'type' 		=> 'varchar-32',
			'name' 		=> '平台',
			'default' 	=> '1',
			'desc' 		=> '平台',
			'match' 	=> 'is_string',
			'update'	=> 'select',
			'search'	=> 'select',
			'option'	=> $source_type,
			'list'		=> true,
		),

		'appname'		=> array
		(
			'type' 		=> 'varchar-50',
			'name' 		=> 'app名称',
			'default' 	=> '',
			'desc' 		=> 'app名称',
			'match' 	=> 'is_string',
			'update'	=> 'text',
			//'list'		=> true,
		),
		
		'name'		=> array
		(
			'type' 		=> 'varchar-32',
			'name' 		=> '版本名称',
			'default' 	=> '',
			'desc' 		=> '请输入名称',
			'match' 	=> 'is_string',
			'update'	=> 'text',
			'search'	=> 'fulltext',
			'list'		=> true,
		),

		'code'		=> array
		(
			'type' 		=> 'int-11',
			'name' 		=> '版本号-只能填写数字',
			'default' 	=> '',
			'desc' 		=> '版本号',
			'match' 	=> 'is_numeric',
			'update'	=> 'text',
			'search'	=> 'fulltext',
			'order'		=> 'desc',
			'list'		=> true,
		),

		'desc'		=> array
		(
			'type' 		=> 'varchar-500',
			'name' 		=> '版本描述',
			'default' 	=> '',
			'desc' 		=> '版本描述',
			'match' 	=> 'is_string',
			'update'	=> 'textarea',
		),

		'up'		=> array
		(
			'type' 		=> 'int-11',
			'name' 		=> '是否强制升级',
			'default' 	=> '2',
			'desc' 		=> '是否强制升级',
			'match' 	=> 'is_numeric',
			'update'	=> 'select',
			'option'	=> $up,
		),

		'link'		=> array
		(
			'type' 		=> 'varchar-400',
			'name' 		=> '下载链接',
			'default' 	=> '',
			'desc' 		=> '下载链接',
			'match' 	=> 'is_string',
			'update'	=> 'text',
		),

		'file'		=> array
		(
			'type' 		=> 'varchar-150',
			'name' 		=> '上传APP文件',
			'default' 	=> '',
			'desc' 		=> '上传APP文件',
			'match' 	=> 'option',
			'update'	=> 'upload',
			'key' 		=> '7',
			'upload'	=> 'qiniu',
			'large' 	=> true,
			//不覆盖原文件,生成新文件
			'cover'		=> 2,
		),

		'updates'		=> array
		(
			'type' 		=> 'int-11',
			'name' 		=> '是否显示更新提醒',
			'default' 	=> '2',
			'desc' 		=> '是否显示更新提醒',
			'match' 	=> 'is_numeric',
			'update'	=> 'radio',
			'option'	=> $update,
		),

		'login'		=> array
		(
			'type' 		=> 'int-11',
			'name' 		=> '是否强制登录',
			'default' 	=> '2',
			'desc' 		=> '是否强制登录',
			'match' 	=> 'is_numeric',
			'update'	=> 'radio',
			'option'	=> $login,
		),

		'anonymous'		=> array
		(
			'type' 		=> 'int-11',
			'name' 		=> '是否匿名登录',
			'default' 	=> '2',
			'desc' 		=> '是否匿名登录',
			'match' 	=> 'is_numeric',
			'update'	=> 'radio',
			'option'	=> $anonymous,
		),

		'vip'		=> array
		(
			'type' 		=> 'int-11',
			'name' 		=> '会员-是否显示会员信息和会员按钮',
			'default' 	=> '2',
			'desc' 		=> '会员',
			'match' 	=> 'is_numeric',
			'update'	=> 'radio',
			'option'	=> $vip,
		),

		'button'		=> array
		(
			'type' 		=> 'int-11',
			'name' 		=> '兑换阅读按钮-是否显示兑换阅读按钮',
			'default' 	=> '2',
			'desc' 		=> '兑换阅读按钮',
			'match' 	=> 'is_numeric',
			'update'	=> 'radio',
			'option'	=> $button,
		),

		'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,
			'list'		=> 'date("Y-m-d H:i:s", {cdate})',
		),
	),

	'request' => array
	(
		'getOne' => array
		(
			# 匹配的正则或函数 选填项
			'option' => array
			(
				'source_type' => 'yes',
				'code' => 'yes',
				'name' => 'yes',
				'state' => 1,
			),
			'type' => 'one',
			'order' => array('code' => 'desc', 'cdate' => 'desc'),
			'col' => '*',
		),
	),
);