info.php 9.9 KB

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