upload.php 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  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' => 10,
  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-255',
  81. 'name' => '限制文件后缀类型-多个用逗号隔开',
  82. 'default' => '',
  83. 'desc' => '请输入限制文件类型',
  84. 'match' => 'option',
  85. 'update' => 'text',
  86. 'list' => true,
  87. ),
  88. 'cover' => array
  89. (
  90. 'type' => 'int-1',
  91. 'name' => '是否覆盖',
  92. 'default' => '1',
  93. 'desc' => '请选择是否覆盖',
  94. 'match' => 'is_numeric',
  95. 'option' => $cover,
  96. 'update' => 'radio',
  97. 'list' => true,
  98. ),
  99. 'state' => array
  100. (
  101. 'type' => 'tinyint-1',
  102. 'name' => '状态',
  103. 'default' => '1',
  104. 'desc' => '请选择状态',
  105. 'match' => 'is_numeric',
  106. 'option' => $option,
  107. 'update' => 'radio',
  108. 'list' => true,
  109. ),
  110. 'cdate' => array
  111. (
  112. 'type' => 'int-11',
  113. 'name' => '录入时间',
  114. 'match' => array('is_numeric', time()),
  115. 'desc' => '',
  116. # 只有insert时才生效
  117. 'insert' => true,
  118. 'list' => 'date("Y-m-d H:i:s", {cdate})',
  119. ),
  120. ),
  121. # 默认值
  122. 'default' => array
  123. (
  124. 'col' => 'name,cover,type,state,cdate',
  125. 'value' => array
  126. (
  127. '"默认图片配置",1,"jpg,png,gif",1,' . time(),
  128. '"默认音频配置",1,"mp3",1,' . time(),
  129. '"默认视频配置",1,"mp4",1,' . time(),
  130. '"默认文件配置",1,"jpg,png,gif,doc,pdf,rar,zip,xls,xlsx,docx",1,' . time(),
  131. ),
  132. ),
  133. # request 请求接口定义
  134. 'request' => array
  135. (
  136. # info 取一条正常的数据
  137. 'info' => array
  138. (
  139. # 匹配的正则或函数 必填项
  140. 'where' => array
  141. (
  142. 'id' => 'is_numeric',
  143. 'state' => 1,
  144. ),
  145. 'type' => 'one',
  146. ),
  147. ),
  148. );