cate.php 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  1. <?php
  2. $cate = function()
  3. {
  4. $array = array(-1 => array('name' => '父级分类'));
  5. $cate = Dever::load('spider/cate-mainAll');
  6. if ($cate) {
  7. $array += $cate;
  8. }
  9. return $array;
  10. };
  11. return array
  12. (
  13. # 表名
  14. 'name' => 'cate',
  15. # 显示给用户看的名称
  16. 'lang' => '分类',
  17. 'order' => 10,
  18. # 数据结构
  19. 'struct' => array
  20. (
  21. 'id' => array
  22. (
  23. 'type' => 'int-11',
  24. 'name' => '分类ID',
  25. 'default' => '',
  26. 'desc' => '',
  27. 'match' => 'is_numeric',
  28. //'search' => 'order',
  29. 'order' => 'desc',
  30. 'list' => true,
  31. ),
  32. 'name' => array
  33. (
  34. 'type' => 'varchar-60',
  35. 'name' => '分类名称',
  36. 'default' => '',
  37. 'desc' => '请输入分类名称',
  38. 'match' => 'is_string',
  39. 'update' => 'text',
  40. 'search' => 'fulltext',
  41. 'list' => true,
  42. ),
  43. 'cate_id' => array
  44. (
  45. 'type' => 'int-11',
  46. 'name' => '上级分类',
  47. 'default' => Dever::input('option_cate_id', -1),
  48. 'desc' => '请选择上级分类',
  49. 'match' => 'is_numeric',
  50. 'update' => 'select',
  51. 'search' => 'order,select',
  52. 'list' => '{cate_id} > 0 ? Dever::load("spider/cate-one#name", {cate_id}) : "父级分类"',
  53. 'option' => $cate,
  54. ),
  55. 'reorder' => array
  56. (
  57. 'type' => 'int-11',
  58. 'name' => '排序(数值越大越靠前)',
  59. 'default' => '1',
  60. 'desc' => '请输入排序',
  61. 'match' => 'option',
  62. 'update' => 'text',
  63. 'search' => 'order',
  64. 'list_name' => '排序',
  65. 'list' => true,
  66. 'order' => 'desc',
  67. 'edit' => true,
  68. ),
  69. 'state' => array
  70. (
  71. 'type' => 'tinyint-1',
  72. 'name' => '状态',
  73. 'default' => '1',
  74. 'desc' => '请选择状态',
  75. 'match' => 'is_numeric',
  76. ),
  77. 'cdate' => array
  78. (
  79. 'type' => 'int-11',
  80. 'name' => '录入时间',
  81. 'match' => array('is_numeric', time()),
  82. 'desc' => '',
  83. # 只有insert时才生效
  84. 'insert' => true,
  85. 'list' => 'date("Y-m-d H:i:s", {cdate})',
  86. ),
  87. ),
  88. 'manage' => array
  89. (
  90. # 列表页的类型
  91. 'list_type' => 'parent',
  92. 'list_button' => array
  93. (
  94. 'add' => array('新增子分类', '"cate&option_cate_id={id}"', '{cate_id}<=0'),
  95. //6 => '删除'
  96. ),
  97. ),
  98. # request 请求接口定义
  99. 'request' => array
  100. (
  101. # info 取一条正常的数据
  102. 'info' => array
  103. (
  104. 'where' => array
  105. (
  106. 'id' => 'is_numeric',
  107. 'state' => 1,
  108. ),
  109. 'type' => 'one',
  110. ),
  111. 'link' => array
  112. (
  113. 'where' => array
  114. (
  115. 'link' => 'is_string',
  116. 'state' => 1,
  117. ),
  118. 'type' => 'one',
  119. ),
  120. # main 取所有主分类
  121. 'main' => array
  122. (
  123. 'where' => array
  124. (
  125. 'cate_id' => -1,
  126. 'state' => 1,
  127. ),
  128. 'type' => 'all',
  129. 'order' => array
  130. (
  131. 'reorder' => 'desc',
  132. 'id' => 'desc',
  133. ),
  134. 'col' => '*|id',
  135. ),
  136. # 取所有下级分类
  137. 'child' => array
  138. (
  139. 'where' => array
  140. (
  141. 'cate_id' => array('1', '>='),
  142. 'state' => 1,
  143. ),
  144. 'type' => 'all',
  145. 'order' => array
  146. (
  147. 'reorder' => 'desc',
  148. 'id' => 'desc',
  149. ),
  150. 'col' => '*|cate_id|id|',
  151. ),
  152. # main 取所有主分类
  153. 'mainAll' => array
  154. (
  155. 'where' => array
  156. (
  157. 'cate_id' => -1,
  158. 'state' => 1,
  159. ),
  160. 'type' => 'all',
  161. 'order' => array
  162. (
  163. 'reorder' => 'desc',
  164. 'id' => 'desc',
  165. ),
  166. 'col' => '*|id',
  167. ),
  168. # 取所有下级分类
  169. 'childAll' => array
  170. (
  171. 'where' => array
  172. (
  173. 'cate_id' => array('1', '>='),
  174. 'state' => 1,
  175. ),
  176. 'type' => 'all',
  177. 'order' => array
  178. (
  179. 'reorder' => 'desc',
  180. 'id' => 'desc',
  181. ),
  182. 'col' => '*|cate_id|id|',
  183. ),
  184. ),
  185. );