info.php 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393
  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. //8 => '多级分类',
  22. 9 => '区间输入框',
  23. 10 => '单选框',
  24. 11 => '多选框',
  25. 12 => '单项选择框',
  26. );
  27. $option = array
  28. (
  29. 1 => '必填项',
  30. 2 => '选填项',
  31. );
  32. $data_type = array
  33. (
  34. 1 => '数字',
  35. 2 => '字符',
  36. 3 => '正则匹配',
  37. );
  38. /*
  39. 使用该组件,这么用
  40. $attr = function()
  41. {
  42. $auth = Dever::load('attr/api.get', false);
  43. return $auth;
  44. };
  45. 'attr' => array
  46. (
  47. 'type' => 'varchar-800',
  48. 'name' => '属性设置',
  49. 'default' => '',
  50. 'desc' => '属性设置',
  51. 'match' => 'option',
  52. 'update' => 'checkbox',
  53. 'option' => $attr,
  54. 'update_input' => '',
  55. 'update_input_default' => '',
  56. 'update_parent' => 'checkbox',
  57. ),
  58. 'attr_input' => array
  59. (
  60. 'type' => 'text-255',
  61. 'name' => '属性值设置',
  62. 'default' => '',
  63. 'desc' => '属性值设置',
  64. 'match' => 'option',
  65. ),
  66. */
  67. return array
  68. (
  69. # 表名
  70. 'name' => 'info',
  71. # 显示给用户看的名称
  72. 'lang' => '属性设置',
  73. # 是否显示在后台菜单
  74. 'order' => 10,
  75. # 数据结构
  76. 'struct' => array
  77. (
  78. 'id' => array
  79. (
  80. 'type' => 'int-11',
  81. 'name' => 'ID',
  82. 'default' => '',
  83. 'desc' => '',
  84. 'match' => 'is_numeric',
  85. 'order' => 'asc',
  86. 'list' => true,
  87. ),
  88. 'name' => array
  89. (
  90. 'type' => 'varchar-150',
  91. 'name' => '名称',
  92. 'default' => '',
  93. 'desc' => '名称',
  94. 'match' => 'is_string',
  95. 'update' => 'text',
  96. 'search' => 'fulltext',
  97. 'list' => true,
  98. 'edit' => true,
  99. ),
  100. 'unit' => array
  101. (
  102. 'type' => 'varchar-150',
  103. 'name' => '单位-填写属性单位,选填项',
  104. 'default' => '',
  105. 'desc' => '单位',
  106. 'match' => 'option',
  107. 'update' => 'text',
  108. ),
  109. 'ename' => array
  110. (
  111. 'type' => 'varchar-150',
  112. 'name' => '英文标识-该标识一般为前端样式名称,选填项',
  113. 'default' => '',
  114. 'desc' => '英文名称',
  115. 'match' => 'option',
  116. 'update' => 'text',
  117. //'search' => 'fulltext',
  118. //'list' => true,
  119. //'edit' => true,
  120. ),
  121. 'icon' => array
  122. (
  123. 'type' => 'varchar-150',
  124. 'name' => '图标',
  125. 'default' => '',
  126. 'desc' => '图标',
  127. 'match' => 'option',
  128. 'update' => 'image',
  129. 'key' => 1,
  130. ),
  131. 'color' => array
  132. (
  133. 'type' => 'varchar-10',
  134. 'name' => '字体颜色-请填写颜色代码',
  135. 'default' => '',
  136. 'desc' => '字体颜色',
  137. 'match' => 'option',
  138. 'update' => 'color',
  139. ),
  140. 'bgcolor' => array
  141. (
  142. 'type' => 'varchar-10',
  143. 'name' => '背景颜色-请填写颜色代码',
  144. 'default' => '',
  145. 'desc' => '背景颜色',
  146. 'match' => 'option',
  147. 'update' => 'color',
  148. ),
  149. 'cate_id' => array
  150. (
  151. 'type' => 'int-11',
  152. 'name' => '属性类别',
  153. 'default' => '1',
  154. 'desc' => '属性类别',
  155. 'match' => 'is_numeric',
  156. 'update' => 'select',
  157. 'option' => $cate,
  158. 'list' => '{cate_id} > 0 ? Dever::load("attr/cate-one#name", {cate_id}) : "未选择"',
  159. ),
  160. 'type' => array
  161. (
  162. 'type' => 'tinyint-11',
  163. 'name' => '属性类型',
  164. 'default' => '1',
  165. 'desc' => '属性类型',
  166. 'match' => 'is_numeric',
  167. 'update' => 'radio',
  168. 'option' => $type,
  169. 'search' => 'select',
  170. 'list' => true,
  171. 'control' => 'type',
  172. ),
  173. 'type_option' => array
  174. (
  175. 'type' => 'varchar-800',
  176. 'name' => '属性可选项-多个值用换行隔开,如果是数字或区间输入框,这里定义的是搜索时的选项,比如单价如果需要搜索,可以设置为"100万以下,{v}<=100",半角逗号之后的为表达式,{v}为当前值,如果是区间输入框,则{s}为区间最小值,{e}为区间最大值,如"100万以下,{e}<=100"。',
  177. 'default' => '',
  178. 'desc' => '属性可选项',
  179. 'match' => 'is_string',
  180. 'update' => 'textarea',
  181. //'list' => true,
  182. 'show' => 'type=1,9,10,11,12',
  183. ),
  184. 'option_type' => array
  185. (
  186. 'type' => 'tinyint-1',
  187. 'name' => '是否必填',
  188. 'default' => '1',
  189. 'desc' => '是否必填',
  190. 'match' => 'is_numeric',
  191. 'update' => 'radio',
  192. 'option' => $option,
  193. 'search' => 'select',
  194. 'list' => true,
  195. ),
  196. 'data_type' => array
  197. (
  198. 'type' => 'tinyint-1',
  199. 'name' => '数据类型-选择类型之后会自动验证数据有效性',
  200. 'default' => '1',
  201. 'desc' => '数据类型',
  202. 'match' => 'is_numeric',
  203. 'update' => 'radio',
  204. 'option' => $data_type,
  205. 'search' => 'select',
  206. //'list' => true,
  207. 'control' => 'data_type',
  208. 'show' => 'type=2',
  209. ),
  210. 'match' => array
  211. (
  212. 'type' => 'varchar-600',
  213. 'name' => '正则匹配规则-直接输入正则表达式即可',
  214. 'default' => '',
  215. 'desc' => '正则匹配规则',
  216. 'match' => 'option',
  217. 'update' => 'textarea',
  218. //'search' => 'fulltext',
  219. //'list' => true,
  220. //'edit' => true,
  221. 'show' => array('data_type' => 3),
  222. ),
  223. 'list_reorder' => array
  224. (
  225. 'type' => 'int-11',
  226. 'name' => '列表页排序-设置该属性在列表页中的排序,数字越大越靠前,如果为负数或者0,则不加入到列表页中。',
  227. 'default' => '-1',
  228. 'desc' => '是否作为搜索条件',
  229. 'match' => 'is_numeric',
  230. 'update' => 'text',
  231. 'show' => 'type=1,2,7,9,10,11,12',
  232. 'search' => 'order',
  233. 'order' => 'desc',
  234. 'edit' => true,
  235. 'list' => true,
  236. ),
  237. 'search_reorder' => array
  238. (
  239. 'type' => 'int-11',
  240. 'name' => '搜索条件排序-设置搜索条件中的排序,数字越大越靠前,如果为负数或者0,则不加入到搜索条件中。',
  241. 'default' => '-1',
  242. 'desc' => '是否作为搜索条件',
  243. 'match' => 'is_numeric',
  244. 'update' => 'text',
  245. 'show' => 'type=1,2,7,9,10,11,12',
  246. 'search' => 'order',
  247. 'order' => 'desc',
  248. 'edit' => true,
  249. 'list' => true,
  250. ),
  251. 'view_reorder' => array
  252. (
  253. 'type' => 'int-11',
  254. 'name' => '详情页排序-设置该属性在详情页中的排序,数字越大越靠前,如果为负数或者0,则不加入到详情页中。',
  255. 'default' => '-1',
  256. 'desc' => '详情页排序',
  257. 'match' => 'is_numeric',
  258. 'update' => 'text',
  259. 'show' => 'type=1,2,7,9,10,11,12',
  260. 'search' => 'order',
  261. 'order' => 'desc',
  262. 'edit' => true,
  263. 'list' => true,
  264. ),
  265. 'state' => array
  266. (
  267. 'type' => 'tinyint-1',
  268. 'name' => '状态',
  269. 'default' => '1',
  270. 'desc' => '请选择状态',
  271. 'match' => 'is_numeric',
  272. ),
  273. 'cdate' => array
  274. (
  275. 'type' => 'int-11',
  276. 'name' => '录入时间',
  277. 'match' => array('is_numeric', time()),
  278. 'desc' => '',
  279. # 只有insert时才生效
  280. 'insert' => true,
  281. //'search' => 'date',
  282. //'list' => 'date("Y-m-d H:i:s", {cdate})',
  283. ),
  284. ),
  285. 'manage' => array
  286. (
  287. # 列表页的类型
  288. ),
  289. 'request' => array
  290. (
  291. 'getAllByIds' => array
  292. (
  293. # 匹配的正则或函数 选填项
  294. 'option' => array
  295. (
  296. 'ids' => array('yes-id', 'in'),
  297. 'state' => 1,
  298. ),
  299. 'type' => 'all',
  300. 'order' => array('list_reorder`+`search_reorder`+`view_reorder' => 'desc', 'id' => 'desc'),
  301. 'col' => '*|id',
  302. ),
  303. 'getListByIds' => array
  304. (
  305. # 匹配的正则或函数 选填项
  306. 'option' => array
  307. (
  308. 'ids' => array('yes-id', 'in'),
  309. 'list_reorder' => array('yes', '>='),
  310. 'state' => 1,
  311. ),
  312. 'type' => 'all',
  313. 'order' => array('list_reorder' => 'desc', 'id' => 'desc'),
  314. 'col' => '*|id',
  315. ),
  316. 'getSearchByIds' => array
  317. (
  318. # 匹配的正则或函数 选填项
  319. 'option' => array
  320. (
  321. 'ids' => array('yes-id', 'in'),
  322. 'search_reorder' => array('yes', '>='),
  323. 'state' => 1,
  324. ),
  325. 'type' => 'all',
  326. 'order' => array('search_reorder' => 'desc', 'id' => 'desc'),
  327. 'col' => '*|id',
  328. ),
  329. 'getViewByIds' => array
  330. (
  331. # 匹配的正则或函数 选填项
  332. 'option' => array
  333. (
  334. 'ids' => array('yes-id', 'in'),
  335. 'view_reorder' => array('yes', '>='),
  336. 'state' => 1,
  337. ),
  338. 'type' => 'all',
  339. 'order' => array('view_reorder' => 'desc', 'id' => 'desc'),
  340. 'col' => '*|id',
  341. ),
  342. /*
  343. 'getSearch' => array
  344. (
  345. # 匹配的正则或函数 选填项
  346. 'option' => array
  347. (
  348. 'ids' => array('yes-id', 'in'),
  349. 'search_reorder' => array('yes', '>='),
  350. 'state' => 1,
  351. ),
  352. 'type' => 'all',
  353. 'order' => array('search_reorder' => 'desc', 'id' => 'desc'),
  354. 'col' => '*',
  355. ),
  356. */
  357. )
  358. );