upload.php 4.5 KB

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