upload.php 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267
  1. <?php
  2. /**
  3. * 上传表
  4. */
  5. # 定义几个常用的选项
  6. $option = array
  7. (
  8. 1 => '启用',
  9. 2 => '关闭',
  10. );
  11. $cover = array
  12. (
  13. 1 => '覆盖原文件',
  14. 2 => '不覆盖,提示错误',
  15. 3 => '不覆盖,直接生成新文件',
  16. );
  17. $yun = function() {
  18. return Dever::db('upload/yun')->state();
  19. };
  20. $save_type = array
  21. (
  22. 1 => '仅本地存储',
  23. 2 => '本地存储为主,云端存储为辅',
  24. 3 => '云端存储为主,本地存储为辅',
  25. 4 => '仅云端存储',
  26. );
  27. $vod_convert = array
  28. (
  29. 1 => '不转码',
  30. 2 => '云端转码',
  31. );
  32. return array
  33. (
  34. # 表名
  35. 'name' => 'upload',
  36. # 显示给用户看的名称
  37. 'lang' => '资源配置',
  38. 'order' => 100,
  39. 'end' => array
  40. (
  41. 'insert' => 'upload/lib/config.create',
  42. 'update' => 'upload/lib/config.create',
  43. ),
  44. # 数据结构
  45. 'struct' => array
  46. (
  47. 'id' => array
  48. (
  49. 'type' => 'int-11',
  50. 'name' => '配置ID',
  51. 'default' => '',
  52. 'desc' => '',
  53. 'match' => 'is_numeric',
  54. 'search' => 'order',
  55. 'list' => true,
  56. ),
  57. 'name' => array
  58. (
  59. 'type' => 'varchar-24',
  60. 'name' => '配置名',
  61. 'default' => '',
  62. 'desc' => '请输入配置名',
  63. 'match' => 'is_string',
  64. 'update' => 'text',
  65. 'search' => 'fulltext',
  66. 'list' => true,
  67. ),
  68. 'width' => array
  69. (
  70. 'type' => 'int-11',
  71. 'name' => '限制宽度-仅限图片类资源',
  72. 'default' => '0',
  73. 'desc' => '请输入宽度',
  74. 'match' => 'option',
  75. 'update' => 'text',
  76. 'list' => true,
  77. ),
  78. 'height' => array
  79. (
  80. 'type' => 'int-11',
  81. 'name' => '限制高度-仅限图片类资源',
  82. 'default' => '0',
  83. 'desc' => '请输入高度',
  84. 'match' => 'option',
  85. 'update' => 'text',
  86. 'list' => true,
  87. ),
  88. 'size' => array
  89. (
  90. 'type' => 'int-11',
  91. 'name' => '限制大小(单位:M)',
  92. 'default' => '2',
  93. 'desc' => '请输入大小',
  94. 'match' => 'option',
  95. 'update' => 'text',
  96. 'list' => true,
  97. ),
  98. 'type' => array
  99. (
  100. 'type' => 'varchar-800',
  101. 'name' => '限制文件后缀类型-多个用逗号隔开',
  102. 'default' => '',
  103. 'desc' => '请输入限制文件类型',
  104. 'match' => 'option',
  105. 'update' => 'text',
  106. 'list' => true,
  107. ),
  108. 'alter' => array
  109. (
  110. 'type' => 'varchar-255',
  111. 'name' => '默认的后续操作-t=1&c=1&w=1,其中t代表缩略图,1代表对应的id,c代表裁剪图,w代表水印图,仅限图片类资源',
  112. 'default' => '',
  113. 'desc' => '默认的后续操作',
  114. 'match' => 'option',
  115. 'update' => 'text',
  116. //'list' => true,
  117. ),
  118. 'cover' => array
  119. (
  120. 'type' => 'int-1',
  121. 'name' => '是否覆盖-将根据上传时的文件名进行文件覆盖操作',
  122. 'default' => '1',
  123. 'desc' => '请选择是否覆盖',
  124. 'match' => 'is_numeric',
  125. 'option' => $cover,
  126. 'update' => 'radio',
  127. 'list' => true,
  128. ),
  129. 'save_type' => array
  130. (
  131. 'type' => 'int-1',
  132. 'name' => '存储位置',
  133. 'default' => '1',
  134. 'desc' => '存储位置',
  135. 'match' => 'is_numeric',
  136. 'option' => $save_type,
  137. 'update' => 'radio',
  138. //'list' => true,
  139. 'control' => 'save_type',
  140. ),
  141. 'yun' => array
  142. (
  143. 'type' => 'int-1',
  144. 'name' => '选择云端',
  145. 'default' => '1',
  146. 'desc' => '选择云端',
  147. 'match' => 'is_numeric',
  148. 'option' => $yun,
  149. 'update' => 'select',
  150. //'list' => true,
  151. 'show' => 'save_type=2,3,4',
  152. ),
  153. 'bucket' => array
  154. (
  155. 'type' => 'varchar-800',
  156. 'name' => 'bucket名称',
  157. 'default' => '',
  158. 'desc' => 'bucket名称',
  159. 'match' => 'option',
  160. 'update' => 'text',
  161. //'list' => true,
  162. 'show' => 'save_type=2,3,4',
  163. ),
  164. 'vod_convert' => array
  165. (
  166. 'type' => 'int-1',
  167. 'name' => '是否进行视频转码',
  168. 'default' => '1',
  169. 'desc' => '是否进行视频转码',
  170. 'match' => 'is_numeric',
  171. 'option' => $vod_convert,
  172. //'update' => 'radio',
  173. //'list' => true,
  174. 'show' => 'save_type=2,3,4',
  175. 'control' => 'vod_convert',
  176. ),
  177. 'pipeline' => array
  178. (
  179. 'type' => 'varchar-800',
  180. 'name' => '队列名称-多个用逗号隔开,将随机使用队列',
  181. 'default' => '',
  182. 'desc' => '队列名称',
  183. 'match' => 'option',
  184. //'update' => 'textarea',
  185. //'list' => true,
  186. 'show' => 'vod_convert=2',
  187. ),
  188. 'state' => array
  189. (
  190. 'type' => 'tinyint-1',
  191. 'name' => '状态',
  192. 'default' => '1',
  193. 'desc' => '请选择状态',
  194. 'match' => 'is_numeric',
  195. ),
  196. 'cdate' => array
  197. (
  198. 'type' => 'int-11',
  199. 'name' => '录入时间',
  200. 'match' => array('is_numeric', time()),
  201. 'desc' => '',
  202. # 只有insert时才生效
  203. 'insert' => true,
  204. 'list' => 'date("Y-m-d H:i:s", {cdate})',
  205. ),
  206. ),
  207. # 默认值
  208. 'default' => array
  209. (
  210. 'col' => 'name,cover,type,state,cdate',
  211. 'value' => array
  212. (
  213. '"默认图片配置",1,"jpg,png,gif",1,' . time(),
  214. '"默认音频配置",1,"mp3",1,' . time(),
  215. '"默认视频配置",1,"video",1,' . time(),
  216. '"默认文件配置",1,"jpg,png,gif,doc,pdf,rar,zip,xls,xlsx,docx,msi",1,' . time(),
  217. '"默认音视频配置",1,"video,mp3,flv,mp4",1,' . time(),
  218. ),
  219. ),
  220. 'manage' => array
  221. (
  222. 'button' => array
  223. (
  224. '图片水印配置' => array('location', 'manage/project/database/list&project=upload&table=pic_water&oper_table=upload'),
  225. '图片缩略配置' => array('location', 'manage/project/database/list&project=upload&table=pic_thumb&oper_table=upload'),
  226. '图片裁剪配置' => array('location', 'manage/project/database/list&project=upload&table=pic_crop&oper_table=upload'),
  227. ),
  228. ),
  229. # request 请求接口定义
  230. 'request' => array
  231. (
  232. # info 取一条正常的数据
  233. 'info' => array
  234. (
  235. # 匹配的正则或函数 必填项
  236. 'where' => array
  237. (
  238. 'id' => 'is_numeric',
  239. 'state' => 1,
  240. ),
  241. 'type' => 'one',
  242. ),
  243. ),
  244. );