info.php 12 KB

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