cate.php 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  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. 'pic' => array
  57. (
  58. 'type' => 'varchar-150',
  59. 'name' => '首页图片',
  60. 'default' => '',
  61. 'desc' => '请选择首页图片',
  62. 'match' => 'is_string',
  63. 'update' => 'image',
  64. 'key' => '1',
  65. 'place' => '150',
  66. ),
  67. 'reorder' => array
  68. (
  69. 'type' => 'int-11',
  70. 'name' => '排序(数值越大越靠前)',
  71. 'default' => '1',
  72. 'desc' => '请输入排序',
  73. 'match' => 'option',
  74. 'update' => 'text',
  75. 'search' => 'order',
  76. 'list_name' => '排序',
  77. 'list' => true,
  78. 'order' => 'desc',
  79. 'edit' => true,
  80. ),
  81. 'state' => array
  82. (
  83. 'type' => 'tinyint-1',
  84. 'name' => '状态',
  85. 'default' => '1',
  86. 'desc' => '请选择状态',
  87. 'match' => 'is_numeric',
  88. ),
  89. 'cdate' => array
  90. (
  91. 'type' => 'int-11',
  92. 'name' => '录入时间',
  93. 'match' => array('is_numeric', time()),
  94. 'desc' => '',
  95. # 只有insert时才生效
  96. 'insert' => true,
  97. 'list' => 'date("Y-m-d H:i:s", {cdate})',
  98. ),
  99. ),
  100. 'manage' => array
  101. (
  102. # 列表页的类型
  103. 'list_type' => 'parent',
  104. 'list_button' => array
  105. (
  106. 'add' => array('新增子栏目', '"cate&option_cate_id={id}"', '{cate_id}<=0'),
  107. //6 => '删除'
  108. ),
  109. ),
  110. # request 请求接口定义
  111. 'request' => array
  112. (
  113. 'getAll' => array
  114. (
  115. # 匹配的正则或函数 选填项
  116. 'option' => array
  117. (
  118. 'cate_id' => 'yes',
  119. 'state' => 1,
  120. ),
  121. 'type' => 'all',
  122. 'order' => array('reorder' => 'desc', 'id' => 'desc'),
  123. 'col' => '*',
  124. ),
  125. # main 取所有主栏目
  126. 'mainAll' => array
  127. (
  128. 'where' => array
  129. (
  130. 'cate_id' => -1,
  131. 'state' => 1,
  132. ),
  133. 'type' => 'all',
  134. 'order' => array('reorder' => 'desc', 'id' => 'desc'),
  135. 'col' => '*|id',
  136. ),
  137. # 取所有下级栏目
  138. 'childAll' => array
  139. (
  140. 'where' => array
  141. (
  142. 'cate_id' => array('1', '>='),
  143. 'state' => 1,
  144. ),
  145. 'type' => 'all',
  146. 'order' => array('reorder' => 'desc', 'id' => 'desc'),
  147. 'col' => '*|cate_id|id|',
  148. ),
  149. ),
  150. );