info.php 7.9 KB

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