upload.php 6.4 KB

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