cate.php 3.4 KB

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