| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288 | <?php/** * 上传表 */ # 定义几个常用的选项$option = array(	1 => '启用',	2 => '关闭',);$cover = array(	1 => '覆盖原文件',	2 => '不覆盖,提示错误',	3 => '不覆盖,直接生成新文件',);$yun = function() {	return Dever::db('upload/yun')->state();};$save_type = array(	1 => '仅本地存储',	2 => '本地存储为主,云端存储为辅',	3 => '云端存储为主,本地存储为辅',	4 => '仅云端存储',);$vod_convert = array(	1 => '不转码',	2 => '云端转码',);$wh = array(	1 => '不限制',	2 => '高度小于宽度-横图',	3 => '高度大于宽度-竖图',);return array(	# 表名	'name' => 'upload',	# 显示给用户看的名称	'lang' => '资源配置',	'order'	=> 100,	'end' => array	(		'insert' => 'upload/lib/config.create',		'update' => 'upload/lib/config.create',	),	# 数据结构	'struct' => array	(		'id' 		=> array		(			'type' 		=> 'int-11',			'name' 		=> '配置ID',			'default' 	=> '',			'desc' 		=> '',			'match' 	=> 'is_numeric',			'search'	=> 'order',			'list'		=> true,		),				'name'		=> array		(			'type' 		=> 'varchar-24',			'name' 		=> '配置名',			'default' 	=> '',			'desc' 		=> '请输入配置名',			'match' 	=> 'is_string',			'update'	=> 'text',			'search'	=> 'fulltext',			'list'		=> true,		),		'setwh'		=> array		(			'type' 		=> 'int-1',			'name' 		=> '宽高限制-仅限图片类资源',			'default' 	=> '1',			'desc' 		=> '宽高限制',			'match' 	=> 'is_numeric',			'option' 	=> $wh,			'update'	=> 'radio',		),				'width'		=> array		(			'type' 		=> 'int-11',			'name' 		=> '最小宽度-仅限图片类资源,设置后上传如果小于该数值,则不能上传成功',			'default' 	=> '0',			'desc' 		=> '请输入宽度',			'match' 	=> 'option',			'update'	=> 'text',			'list'		=> true,		),				'height'		=> array		(			'type' 		=> 'int-11',			'name' 		=> '最小高度-仅限图片类资源,设置后上传如果小于该数值,则不能上传成功',			'default' 	=> '0',			'desc' 		=> '请输入高度',			'match' 	=> 'option',			'update'	=> 'text',			'list'		=> true,		),				'size'		=> array		(			'type' 		=> 'int-11',			'name' 		=> '限制大小(单位:M)',			'default' 	=> '2',			'desc' 		=> '请输入大小',			'match' 	=> 'option',			'update'	=> 'text',			'list'		=> true,		),				'type'		=> array		(			'type' 		=> 'varchar-800',			'name' 		=> '限制文件后缀类型-多个用逗号隔开',			'default' 	=> '',			'desc' 		=> '请输入限制文件类型',			'match' 	=> 'option',			'update'	=> 'text',			'list'		=> true,		),		'alter'		=> array		(			'type' 		=> 'varchar-255',			'name' 		=> '默认的后续操作-t=1&c=1&w=1,其中t代表缩略图,1代表对应的id,c代表裁剪图,w代表水印图,仅限图片类资源',			'default' 	=> '',			'desc' 		=> '默认的后续操作',			'match' 	=> 'option',			'update'	=> 'text',			//'list'		=> true,		),				'cover'		=> array		(			'type' 		=> 'int-1',			'name' 		=> '是否覆盖-将根据上传时的文件名进行文件覆盖操作',			'default' 	=> '1',			'desc' 		=> '请选择是否覆盖',			'match' 	=> 'is_numeric',			'option' 	=> $cover,			'update'	=> 'radio',			'list'		=> true,		),		'save_type'		=> array		(			'type' 		=> 'int-1',			'name' 		=> '存储位置-如需进行后续操作,云端不支持,则需要本地处理、云端存储,建议选择云端存储为主,本地存储为辅',			'default' 	=> '1',			'desc' 		=> '存储位置',			'match' 	=> 'is_numeric',			'option' 	=> $save_type,			'update'	=> 'radio',			//'list'		=> true,			'control'	=> 'save_type',		),		'yun'		=> array		(			'type' 		=> 'int-1',			'name' 		=> '选择云端',			'default' 	=> '1',			'desc' 		=> '选择云端',			'match' 	=> 'is_numeric',			'option' 	=> $yun,			'update'	=> 'select',			//'list'		=> true,			'show'	=> 'save_type=2,3,4',		),		'bucket'		=> array		(			'type' 		=> 'varchar-800',			'name' 		=> 'bucket名称',			'default' 	=> '',			'desc' 		=> 'bucket名称',			'match' 	=> 'option',			'update'	=> 'text',			//'list'		=> true,			'show'	=> 'save_type=2,3,4',		),		'vod_convert'		=> array		(			'type' 		=> 'int-1',			'name' 		=> '是否进行视频转码',			'default' 	=> '1',			'desc' 		=> '是否进行视频转码',			'match' 	=> 'is_numeric',			'option' 	=> $vod_convert,			//'update'	=> 'radio',			//'list'		=> true,			'show'	=> 'save_type=2,3,4',			'control'	=> 'vod_convert',		),		'pipeline'		=> array		(			'type' 		=> 'varchar-800',			'name' 		=> '队列名称-多个用逗号隔开,将随机使用队列',			'default' 	=> '',			'desc' 		=> '队列名称',			'match' 	=> 'option',			//'update'	=> 'textarea',			//'list'		=> true,			'show'	=> 'vod_convert=2',		),				'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})',		),	),		# 默认值	'default' => array	(		'col' => 'name,cover,type,size,state,cdate',		'value' => array		(			'"默认图片配置",1,"jpg,png,gif,webp",2,1,' . time(),			'"默认音频配置",1,"mp3,m4a",20,1,' . time(),			'"默认视频配置",1,"video,flv,mp4,webm",200,1,' . time(),			'"默认文件配置",1,"jpg,png,gif,doc,pdf,rar,zip,xls,xlsx,docx,msi",20,1,' . time(),			'"默认音视频配置",1,"video,mp3,flv,mp4,webm,mov,m4a",200,1,' . time(),			'"用户上传图片",1,"jpg,png,gif,webp",2,1,' . time(),			'"裁剪图片",1,"jpg,png,gif,webp",2,1,' . time(),		),	),	'manage' => array	(		'button' => array		(			'图片水印配置' => array('location', 'manage/project/database/list&project=upload&table=pic_water&oper_table=upload'),			'图片缩略配置' => array('location', 'manage/project/database/list&project=upload&table=pic_thumb&oper_table=upload'),			'图片裁剪配置' => array('location', 'manage/project/database/list&project=upload&table=pic_crop&oper_table=upload'),		),	),		# request 请求接口定义	'request' => array	(		# info 取一条正常的数据		'info' => array		(			# 匹配的正则或函数 必填项			'where' => array			(				'id' => 'is_numeric',				'state' => 1,			),			'type' => 'one',		),	),);
 |