info.php 9.2 KB

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