| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257 | 
							- <?php
 
- /**
 
-  * 上传表
 
-  * demo: data/upload/upload_name/10000/10/10.thumb_test.jpg
 
-  * 基本操作:根据upload上传、保存到pic表,所有保存到pic表的图片,均可参与后续处理操作 
 
-  */
 
-  
 
- # 定义几个常用的选项
 
- $option = array
 
- (
 
- 	1 => '启用',
 
- 	2 => '关闭',
 
- );
 
- $cate = function()
 
- {
 
- 	return Dever::db('upload/cate')->state();
 
- };
 
- $upload = function()
 
- {
 
- 	return Dever::db('upload/upload')->state();
 
- };
 
- return array
 
- (
 
- 	# 表名
 
- 	'name' => 'file',
 
- 	# 显示给用户看的名称
 
- 	'lang' => '资源列表',
 
- 	'order' => 9,
 
- 	'end' => array
 
- 	(
 
- 		//'insert' => 'upload/manage.add_tag',
 
- 		//'update' => 'upload/manage.add_tag',
 
- 	),
 
- 	/*
 
- 	# 同步更新另外一个或多个表的数据
 
- 	'sync' => array
 
- 	(
 
- 		'upload/file_tag' => array
 
- 		(
 
- 			# 更新另外一个表的字段 => 本表的字段
 
- 			'where' => array('file_id', 'id'),
 
- 			# 要更新的数据
 
- 			'update' => array('tag_id' => 'tag'),
 
- 			# 同步更新的类型,delete为先删再插入,update为先查询是否存在,存在直接更新,不存在则插入, only为仅更新
 
- 			'type' => 'delete',
 
- 		)
 
- 	),*/
 
- 	# 数据结构
 
- 	'struct' => array
 
- 	(
 
- 		'id' 		=> array
 
- 		(
 
- 			'type' 		=> 'int-11',
 
- 			'name' 		=> 'ID',
 
- 			'default' 	=> '',
 
- 			'desc' 		=> '',
 
- 			'match' 	=> 'is_numeric',
 
- 			'search'	=> 'order',
 
- 			//'list'		=> true,
 
- 		),
 
- 		
 
- 		'name'		=> array
 
- 		(
 
- 			'type' 		=> 'varchar-32',
 
- 			'name' 		=> '文件名',
 
- 			'default' 	=> '',
 
- 			'desc' 		=> '请输入文件名',
 
- 			'match' 	=> 'is_string',
 
- 			'search'	=> 'fulltext',
 
- 			//'list'		=> true,
 
- 		),
 
- 		'source_name'		=> array
 
- 		(
 
- 			'type' 		=> 'varchar-200',
 
- 			'name' 		=> '原文件名',
 
- 			'default' 	=> '',
 
- 			'desc' 		=> '请输入原文件名',
 
- 			'match' 	=> 'is_string',
 
- 			'search'	=> 'fulltext',
 
- 			'list'		=> true,
 
- 		),
 
- 		'upload'		=> array
 
- 		(
 
- 			'type' 		=> 'int-11',
 
- 			'name' 		=> '所属资源配置',
 
- 			'default' 	=> '1',
 
- 			'desc' 		=> '分类',
 
- 			'match' 	=> 'is_numeric',
 
- 			'option' 	=> $upload,
 
- 			'update'	=> 'select',
 
- 			'search'	=> 'select',
 
- 			//'control'	=> 'type',
 
- 			//'list'		=> true,
 
- 		),
 
- 		'cate'		=> array
 
- 		(
 
- 			'type' 		=> 'int-11',
 
- 			'name' 		=> '所属分类',
 
- 			'default' 	=> '1',
 
- 			'desc' 		=> '分类',
 
- 			'match' 	=> 'is_numeric',
 
- 			'option' 	=> $cate,
 
- 			'update'	=> 'select',
 
- 			'search'	=> 'select',
 
- 			//'control'	=> 'type',
 
- 			'list'		=> true,
 
- 			'edit'		=> true,
 
- 		),
 
- 		/*
 
- 		'tag'		=> array
 
- 		(
 
- 			'type' 		=> 'text-255',
 
- 			'name' 		=> '标签',
 
- 			'default' 	=> '',
 
- 			'desc' 		=> '标签',
 
- 			'match' 	=> 'is_numeric',
 
- 			'update'	=> 'text',
 
- 			'search'	=> 'fulltext',
 
- 			'autocomplete' => array('upload/manage.search_tag?json=1', 'id', 'upload/manage.search_tag_by_ids'),
 
- 			//'control'	=> 'type',
 
- 			//'list'		=> true,
 
- 		),
 
- 		*/
 
- 		'key'		=> array
 
- 		(
 
- 			'type' 		=> 'varchar-32',
 
- 			'name' 		=> 'key',
 
- 			'default' 	=> '',
 
- 			'desc' 		=> 'key',
 
- 			'match' 	=> 'is_string',
 
- 			//'search'	=> 'fulltext',
 
- 			//'list'		=> true,
 
- 		),
 
- 		
 
- 		'ext'		=> array
 
- 		(
 
- 			'type' 		=> 'varchar-24',
 
- 			'name' 		=> '后缀名',
 
- 			'default' 	=> '',
 
- 			'desc' 		=> '请输入后缀名',
 
- 			'match' 	=> 'is_string',
 
- 			'list_name'	=> '文件信息',
 
- 			'list'		=> 'Dever::load("upload/manage.file", {id})',
 
- 		),
 
- 		
 
- 		'file'		=> array
 
- 		(
 
- 			'type' 		=> 'varchar-150',
 
- 			'name' 		=> '访问路径',
 
- 			'default' 	=> '',
 
- 			'desc' 		=> '请输入访问路径',
 
- 			'match' 	=> 'is_string',
 
- 			//'list'		=> true,
 
- 		),
 
- 		
 
- 		'width'		=> array
 
- 		(
 
- 			'type' 		=> 'int-11',
 
- 			'name' 		=> '宽度',
 
- 			'default' 	=> '0',
 
- 			'desc' 		=> '请输入宽度',
 
- 			'match' 	=> 'option',
 
- 			//'list'		=> true,
 
- 		),
 
- 		
 
- 		'height'		=> array
 
- 		(
 
- 			'type' 		=> 'int-11',
 
- 			'name' 		=> '高度',
 
- 			'default' 	=> '0',
 
- 			'desc' 		=> '请输入高度',
 
- 			'match' 	=> 'option',
 
- 			//'list'		=> true,
 
- 		),
 
- 		
 
- 		'size'		=> array
 
- 		(
 
- 			'type' 		=> 'int-11',
 
- 			'name' 		=> '大小',
 
- 			'default' 	=> '0',
 
- 			'desc' 		=> '请输入大小',
 
- 			'match' 	=> 'option',
 
- 			//'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' 		=> '',
 
- 			'list'		=> 'date("Y-m-d H:i:s", {cdate})',
 
- 		),
 
- 	),
 
- 	'manage' => array
 
- 	(
 
- 		'insert' => false,
 
- 		'delete' => false,
 
- 	),
 
- 	
 
- 	# request 请求接口定义
 
- 	'request' => array
 
- 	(
 
- 		# info 根据文件名获取数据
 
- 		'file' => array
 
- 		(
 
- 			'where' => array
 
- 			(
 
- 				'file' => 'is_string',
 
- 			),
 
- 			'type' => 'one',
 
- 		),
 
- 		
 
- 		'name' => array
 
- 		(
 
- 			'where' => array
 
- 			(
 
- 				'name' => 'is_string',
 
- 			),
 
- 			'type' => 'one',
 
- 		),
 
- 		'getData' => array
 
- 		(
 
- 			'option' => array
 
- 			(
 
- 				'state' => 1,
 
- 				'upload' => 'yes',
 
- 				'cate' => 'yes',
 
- 				'source_name' => array('yes', 'like'),
 
- 				//'source_name' => array('yes', 'like', 'and('),
 
- 				//'name' => array('yes', 'like', 'or)'),
 
- 				
 
- 			),
 
- 			'order' => array('id' => 'desc'),
 
- 			'type' => 'all',
 
- 			'page' => array(12, 'list')
 
- 		),
 
- 	)
 
- );
 
 
  |