upload.php 5.5 KB

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