upload.php 4.8 KB

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