cate.php 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  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. 'getAll' => array
  103. (
  104. # 匹配的正则或函数 选填项
  105. 'option' => array
  106. (
  107. 'cate_id' => 'yes',
  108. 'state' => 1,
  109. ),
  110. 'type' => 'all',
  111. 'order' => array('reorder' => 'desc', 'id' => 'desc'),
  112. 'col' => '*',
  113. ),
  114. # main 取所有主栏目
  115. 'mainAll' => array
  116. (
  117. 'where' => array
  118. (
  119. 'cate_id' => -1,
  120. 'state' => 1,
  121. ),
  122. 'type' => 'all',
  123. 'order' => array('reorder' => 'desc', 'id' => 'desc'),
  124. 'col' => '*|id',
  125. ),
  126. # 取所有下级栏目
  127. 'childAll' => array
  128. (
  129. 'where' => array
  130. (
  131. 'cate_id' => array('1', '>='),
  132. 'state' => 1,
  133. ),
  134. 'type' => 'all',
  135. 'order' => array('reorder' => 'desc', 'id' => 'desc'),
  136. 'col' => '*|cate_id|id|',
  137. ),
  138. ),
  139. );