info.php 10 KB

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