info.php 10.0 KB

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