category.php 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297
  1. <?php
  2. $status = array
  3. (
  4. 1 => '启用',
  5. 2 => '不启用',
  6. );
  7. return array
  8. (
  9. # 表名
  10. 'name' => 'category',
  11. # 显示给用户看的名称
  12. 'lang' => '属性分类设置',
  13. # 是否显示在后台菜单
  14. 'order' => 10,
  15. 'end' => array
  16. (
  17. 'insert' => 'product/lib/manage.updateCategory',
  18. 'update' => 'product/lib/manage.updateCategory',
  19. ),
  20. # 数据结构
  21. 'struct' => array
  22. (
  23. 'id' => array
  24. (
  25. 'type' => 'int-11',
  26. 'name' => 'ID',
  27. 'default' => '',
  28. 'desc' => '',
  29. 'match' => 'is_numeric',
  30. 'list' => true,
  31. ),
  32. 'name' => array
  33. (
  34. 'type' => 'varchar-150',
  35. 'name' => '分类名称',
  36. 'default' => '',
  37. 'desc' => '分类名称',
  38. 'match' => 'is_string',
  39. 'update' => 'text',
  40. 'search' => 'fulltext',
  41. 'list' => true,
  42. 'edit' => true,
  43. ),
  44. 'parent' => array
  45. (
  46. 'type' => 'varchar-800',
  47. 'name' => '上级分类',
  48. 'default' => Dever::input('option_parent', -1),
  49. 'desc' => '请选择上级分类',
  50. 'match' => 'is_string',
  51. 'update' => 'linkage',
  52. 'linkage' => 'id=' . Dever::input('where_id'),
  53. 'option' => Dever::url('category.get', 'product'),
  54. //'list' => 'Dever::load("product/api.string", "{parent}")',
  55. ),
  56. 'parent_id' => array
  57. (
  58. 'type' => 'int-11',
  59. 'name' => '上级分类',
  60. 'default' => -1,
  61. 'desc' => '请选择上级分类',
  62. 'match' => 'is_numeric',
  63. 'value' => Dever::input('option_parent_id', -1),
  64. //'list' => '{parent_id} > 0 ? Dever::load("product/category-one#name", {parent_id}) : "父级分类"',
  65. 'list_name' => '属性',
  66. 'list' => 'Dever::load("product/attr.getInfoByCate", {id})',
  67. ),
  68. 'top_parent_id' => array
  69. (
  70. 'type' => 'int-11',
  71. 'name' => '顶级分类',
  72. 'default' => -1,
  73. 'desc' => '请选择顶级分类',
  74. 'match' => 'is_numeric',
  75. ),
  76. /*
  77. 'product-category_attr'=> array
  78. (
  79. 'name' => '属性设置',
  80. 'default' => '',
  81. 'desc' => '请先选择属性分类',
  82. 'match' => 'option',
  83. # 同步更新另外一个表的内容,两个表相关联的id,更新另一个表的字段
  84. 'sync' => array('id', 'category_id'),
  85. # 根据category字段的值,获取product/attr.search接口的内容
  86. 'update' => array(1),
  87. ),*/
  88. 'level' => array
  89. (
  90. 'type' => 'int-11',
  91. 'name' => '分类级别-1为顶级分类、2为2级分类,-1为最后一级分类',
  92. 'default' => 1,
  93. 'desc' => '分类级别',
  94. 'match' => 'is_numeric',
  95. ),
  96. 'key' => array
  97. (
  98. 'type' => 'varchar-150',
  99. 'name' => '分类标识-该标识一般为前台样式名称,选填项',
  100. 'default' => '',
  101. 'desc' => '标识',
  102. 'match' => 'option',
  103. 'update' => 'text',
  104. //'search' => 'fulltext',
  105. //'list' => true,
  106. //'edit' => true,
  107. 'tab' => 1,
  108. ),
  109. 'icon' => array
  110. (
  111. 'type' => 'varchar-150',
  112. 'name' => '图标',
  113. 'default' => '',
  114. 'desc' => '图标',
  115. 'match' => 'option',
  116. 'update' => 'image',
  117. 'key' => 1,
  118. 'tab' => 1,
  119. ),
  120. 'size' => array
  121. (
  122. 'type' => 'varchar-10',
  123. 'name' => '字体大小-字体px值,为空则使用系统默认字体大小',
  124. 'default' => '',
  125. 'desc' => '字体大小',
  126. 'match' => 'option',
  127. 'update' => 'text',
  128. 'tab' => 1,
  129. ),
  130. 'color' => array
  131. (
  132. 'type' => 'varchar-10',
  133. 'name' => '字体颜色-请填写颜色代码',
  134. 'default' => '',
  135. 'desc' => '字体颜色',
  136. 'match' => 'option',
  137. 'update' => 'color',
  138. 'tab' => 1,
  139. ),
  140. 'bgcolor' => array
  141. (
  142. 'type' => 'varchar-10',
  143. 'name' => '背景颜色-请填写颜色代码',
  144. 'default' => '',
  145. 'desc' => '背景颜色',
  146. 'match' => 'option',
  147. 'update' => 'color',
  148. 'tab' => 1,
  149. ),
  150. 'status' => array
  151. (
  152. 'type' => 'tinyint-1',
  153. 'name' => '是否启用',
  154. 'default' => '1',
  155. 'desc' => '是否启用',
  156. 'match' => 'is_numeric',
  157. //'update' => 'select',
  158. 'option' => $status,
  159. 'list' => true,
  160. 'edit' => true,
  161. ),
  162. 'reorder' => array
  163. (
  164. 'type' => 'int-11',
  165. 'name' => '排序(数值越大越靠前)',
  166. 'default' => '1',
  167. 'desc' => '请输入排序',
  168. 'match' => 'option',
  169. //'update' => 'text',
  170. 'search' => 'order',
  171. 'list_name' => '排序',
  172. 'list' => true,
  173. 'order' => 'desc',
  174. 'edit' => true,
  175. ),
  176. 'state' => array
  177. (
  178. 'type' => 'tinyint-1',
  179. 'name' => '状态',
  180. 'default' => '1',
  181. 'desc' => '请选择状态',
  182. 'match' => 'is_numeric',
  183. ),
  184. 'cdate' => array
  185. (
  186. 'type' => 'int-11',
  187. 'name' => '录入时间',
  188. 'match' => array('is_numeric', time()),
  189. 'desc' => '',
  190. # 只有insert时才生效
  191. 'insert' => true,
  192. //'search' => 'date',
  193. //'list' => 'date("Y-m-d H:i:s", {cdate})',
  194. ),
  195. ),
  196. 'manage' => array
  197. (
  198. //'lang' => 'name',
  199. 'tab' => array('基础设置', '前端样式'),
  200. # 列表页的类型
  201. 'list_type' => 'tree',
  202. 'list_button' => array
  203. (
  204. 'add' => array('新增子分类', '"{parent}" == -1 ? "category&option_parent={id}" : "category&option_parent={parent},{id}"'),
  205. 'list' => array('属性设置', '"category_attr&search_option_category_id={id}&oper_table=category"'),
  206. ),
  207. ),
  208. 'request' => array
  209. (
  210. # 获取顶级分类
  211. 'getTop' => array
  212. (
  213. # 匹配的正则或函数 选填项
  214. 'option' => array
  215. (
  216. 'ids' => array('yes-id', 'in'),
  217. 'parent_id' => -1,
  218. 'state' => 1,
  219. ),
  220. 'type' => 'all',
  221. 'order' => array('reorder' => 'desc', 'id' => 'asc'),
  222. 'col' => '*|id',
  223. ),
  224. 'getChild' => array
  225. (
  226. # 匹配的正则或函数 选填项
  227. 'option' => array
  228. (
  229. 'parent_id' => 'yes',
  230. 'top_parent_id' => 'yes',
  231. 'level' => 'yes',
  232. 'parent_id_in' => array('yes-parent_id', 'in'),
  233. 'id' => array('yes', '!='),
  234. 'parent' => array('yes', 'like'),
  235. 'state' => 1,
  236. ),
  237. 'type' => 'all',
  238. 'order' => array('reorder' => 'desc', 'id' => 'asc'),
  239. 'col' => '*|parent_id|',
  240. ),
  241. 'getList' => array
  242. (
  243. # 匹配的正则或函数 选填项
  244. 'option' => array
  245. (
  246. 'parent_id' => 'yes',
  247. 'top_parent_id' => 'yes',
  248. 'level' => 'yes',
  249. 'parent_id_in' => array('yes-parent_id', 'in'),
  250. 'id' => array('yes', '!='),
  251. 'parent' => array('yes', 'like'),
  252. 'state' => 1,
  253. ),
  254. 'type' => 'all',
  255. 'order' => array('reorder' => 'desc', 'id' => 'asc'),
  256. 'col' => '*',
  257. ),
  258. 'getAll' => array
  259. (
  260. # 匹配的正则或函数 选填项
  261. 'option' => array
  262. (
  263. 'parent_id' => 'yes',
  264. 'id' => array('yes', '!='),
  265. 'state' => 1,
  266. ),
  267. 'type' => 'all',
  268. 'order' => array('reorder' => 'desc', 'id' => 'asc'),
  269. 'col' => 'id as value, name',
  270. ),
  271. )
  272. );