upload.php 3.7 KB

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