info.php 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282
  1. <?php
  2. $cate = function()
  3. {
  4. $array = array();
  5. $info = Dever::load('attr/cate-state');
  6. if($info)
  7. {
  8. $array += $info;
  9. }
  10. return $array;
  11. };
  12. $type = array
  13. (
  14. 1 => '单行输入框',
  15. 2 => '多行输入框',
  16. 3 => '图文编辑器',
  17. 4 => '单图片上传',
  18. 5 => '多图片上传',
  19. 6 => '地区选择器',
  20. //7 => '多级分类',
  21. 10 => '单选框',
  22. 11 => '多选框',
  23. 12 => '单项选择框',
  24. );
  25. $option = array
  26. (
  27. 1 => '必填项',
  28. 2 => '选填项',
  29. );
  30. $data_type = array
  31. (
  32. 1 => '数字',
  33. 2 => '字符',
  34. 3 => '正则匹配',
  35. );
  36. $search = array
  37. (
  38. 1 => '可以作为搜索条件',
  39. 2 => '不作为搜索条件',
  40. );
  41. /*
  42. 使用该组件,这么用
  43. $attr = function()
  44. {
  45. $auth = Dever::load('attr/api.get', false);
  46. return $auth;
  47. };
  48. 'attr' => array
  49. (
  50. 'type' => 'varchar-800',
  51. 'name' => '属性设置',
  52. 'default' => '',
  53. 'desc' => '属性设置',
  54. 'match' => 'option',
  55. 'update' => 'checkbox',
  56. 'option' => $attr,
  57. 'update_input' => '',
  58. 'update_input_default' => '',
  59. 'update_parent' => 'checkbox',
  60. ),
  61. 'attr_input' => array
  62. (
  63. 'type' => 'text-255',
  64. 'name' => '属性值设置',
  65. 'default' => '',
  66. 'desc' => '属性值设置',
  67. 'match' => 'option',
  68. ),
  69. */
  70. return array
  71. (
  72. # 表名
  73. 'name' => 'info',
  74. # 显示给用户看的名称
  75. 'lang' => '属性设置',
  76. # 是否显示在后台菜单
  77. 'order' => 10,
  78. # 数据结构
  79. 'struct' => array
  80. (
  81. 'id' => array
  82. (
  83. 'type' => 'int-11',
  84. 'name' => 'ID',
  85. 'default' => '',
  86. 'desc' => '',
  87. 'match' => 'is_numeric',
  88. 'order' => 'asc',
  89. 'list' => true,
  90. ),
  91. 'name' => array
  92. (
  93. 'type' => 'varchar-150',
  94. 'name' => '中文名称',
  95. 'default' => '',
  96. 'desc' => '中文名称',
  97. 'match' => 'is_string',
  98. 'update' => 'text',
  99. 'search' => 'fulltext',
  100. 'list' => true,
  101. 'edit' => true,
  102. ),
  103. 'ename' => array
  104. (
  105. 'type' => 'varchar-150',
  106. 'name' => '英文名称',
  107. 'default' => '',
  108. 'desc' => '英文名称',
  109. 'match' => 'is_string',
  110. //'update' => 'text',
  111. //'search' => 'fulltext',
  112. //'list' => true,
  113. //'edit' => true,
  114. ),
  115. 'cate_id' => array
  116. (
  117. 'type' => 'int-11',
  118. 'name' => '属性类别',
  119. 'default' => '1',
  120. 'desc' => '属性类别',
  121. 'match' => 'is_numeric',
  122. 'update' => 'select',
  123. 'option' => $cate,
  124. 'list' => '{cate_id} > 0 ? Dever::load("attr/cate-one#name", {cate_id}) : "未选择"',
  125. ),
  126. 'type' => array
  127. (
  128. 'type' => 'tinyint-1',
  129. 'name' => '属性类型',
  130. 'default' => '1',
  131. 'desc' => '属性类型',
  132. 'match' => 'is_numeric',
  133. 'update' => 'radio',
  134. 'option' => $type,
  135. 'search' => 'select',
  136. 'list' => true,
  137. 'control' => 'type',
  138. ),
  139. 'type_option' => array
  140. (
  141. 'type' => 'varchar-800',
  142. 'name' => '属性可选项-多个值用换行隔开',
  143. 'default' => '',
  144. 'desc' => '属性可选项',
  145. 'match' => 'is_string',
  146. 'update' => 'textarea',
  147. //'list' => true,
  148. 'show' => 'type=10,11,12',
  149. ),
  150. 'option_type' => array
  151. (
  152. 'type' => 'tinyint-1',
  153. 'name' => '是否必填',
  154. 'default' => '1',
  155. 'desc' => '是否必填',
  156. 'match' => 'is_numeric',
  157. 'update' => 'radio',
  158. 'option' => $option,
  159. 'search' => 'select',
  160. 'list' => true,
  161. ),
  162. 'data_type' => array
  163. (
  164. 'type' => 'tinyint-1',
  165. 'name' => '数据类型-选择类型之后会自动验证数据有效性',
  166. 'default' => '1',
  167. 'desc' => '数据类型',
  168. 'match' => 'is_numeric',
  169. 'update' => 'radio',
  170. 'option' => $data_type,
  171. 'search' => 'select',
  172. //'list' => true,
  173. 'control' => 'data_type',
  174. 'show' => 'type=1',
  175. ),
  176. 'match' => array
  177. (
  178. 'type' => 'varchar-600',
  179. 'name' => '正则匹配规则-直接输入正则表达式即可',
  180. 'default' => '',
  181. 'desc' => '正则匹配规则',
  182. 'match' => 'option',
  183. 'update' => 'textarea',
  184. //'search' => 'fulltext',
  185. //'list' => true,
  186. //'edit' => true,
  187. 'show' => array('data_type' => 3),
  188. ),
  189. 'search' => array
  190. (
  191. 'type' => 'tinyint-1',
  192. 'name' => '是否作为搜索条件-如果选择作为搜索条件,将把该属性放入搜索引擎中,这里不宜选择过多,否则影响搜索速度。',
  193. 'default' => '2',
  194. 'desc' => '是否作为搜索条件',
  195. 'match' => 'is_numeric',
  196. 'update' => 'radio',
  197. 'option' => $search,
  198. 'search' => 'select',
  199. 'show' => 'type=1,6,10,11,12',
  200. //'list' => true,
  201. ),
  202. 'reorder' => array
  203. (
  204. 'type' => 'int-11',
  205. 'name' => '排序(数值越大越靠前)',
  206. 'default' => '1',
  207. 'desc' => '请输入排序',
  208. 'match' => 'option',
  209. 'update' => 'text',
  210. 'search' => 'order',
  211. 'list_name' => '排序',
  212. 'list' => true,
  213. 'order' => 'desc',
  214. 'edit' => true,
  215. ),
  216. 'state' => array
  217. (
  218. 'type' => 'tinyint-1',
  219. 'name' => '状态',
  220. 'default' => '1',
  221. 'desc' => '请选择状态',
  222. 'match' => 'is_numeric',
  223. ),
  224. 'cdate' => array
  225. (
  226. 'type' => 'int-11',
  227. 'name' => '录入时间',
  228. 'match' => array('is_numeric', time()),
  229. 'desc' => '',
  230. # 只有insert时才生效
  231. 'insert' => true,
  232. 'search' => 'date',
  233. 'list' => 'date("Y-m-d H:i:s", {cdate})',
  234. ),
  235. ),
  236. 'manage' => array
  237. (
  238. # 列表页的类型
  239. ),
  240. 'request' => array
  241. (
  242. 'getAllByIds' => array
  243. (
  244. # 匹配的正则或函数 选填项
  245. 'option' => array
  246. (
  247. 'ids' => array('yes-id', 'in'),
  248. 'state' => 1,
  249. ),
  250. 'type' => 'all',
  251. 'order' => array('reorder' => 'desc', 'id' => 'desc'),
  252. 'col' => '*|id',
  253. ),
  254. )
  255. );