9bfa76ca359c93e9d8eb309dbcfb17c7d0ef8633.svn-base 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. <?php
  2. # 定义几个常用的选项
  3. $option = array
  4. (
  5. 1 => '生效',
  6. 2 => '失效',
  7. );
  8. return array
  9. (
  10. # 表名
  11. 'name' => 'top',
  12. # 显示给用户看的名称
  13. 'lang' => '头部菜单设置',
  14. 'menu' => false,
  15. # 数据结构
  16. 'struct' => array
  17. (
  18. 'id' => array
  19. (
  20. 'type' => 'int-11',
  21. 'name' => 'ID',
  22. 'default' => '',
  23. 'desc' => '',
  24. 'match' => 'is_numeric',
  25. 'order' => 'desc',
  26. ),
  27. 'name' => array
  28. (
  29. 'type' => 'varchar-50',
  30. 'name' => '权限名',
  31. 'default' => '',
  32. 'desc' => '请输入权限名',
  33. 'match' => 'is_string',
  34. 'update' => 'text',
  35. 'search' => 'order,fulltext',
  36. 'list' => true,
  37. ),
  38. 'top_id' => array
  39. (
  40. 'type' => 'int-11',
  41. 'name' => '上级权限',
  42. 'default' => -1,
  43. 'desc' => '请选择上级权限',
  44. 'match' => 'is_numeric',
  45. 'update' => 'select',
  46. 'search' => 'order,select',
  47. 'list' => '{top_id} > 0 ? Maze::load("manage/top-one#name", {top_id}) : "父级权限"',
  48. ),
  49. 'key' => array
  50. (
  51. 'type' => 'varchar-100',
  52. 'name' => '权限key',
  53. 'default' => '',
  54. 'desc' => '请输入权限key',
  55. 'match' => 'is_string',
  56. 'update' => 'text',
  57. 'search' => 'fulltext',
  58. 'list' => true,
  59. ),
  60. 'value' => array
  61. (
  62. 'type' => 'varchar-30',
  63. 'name' => '对应的值',
  64. 'default' => '',
  65. 'desc' => '请输入对应的值',
  66. 'match' => 'is_string',
  67. 'update' => 'text',
  68. 'search' => 'fulltext',
  69. 'list' => true,
  70. ),
  71. 'state' => array
  72. (
  73. 'type' => 'tinyint-1',
  74. 'name' => '状态',
  75. 'default' => '1',
  76. 'desc' => '请选择状态',
  77. 'match' => array('is_numeric', 1),
  78. 'option' => $option,
  79. 'update' => 'radio',
  80. 'list' => true,
  81. ),
  82. 'cdate' => array
  83. (
  84. 'type' => 'int-11',
  85. 'name' => '录入时间',
  86. 'match' => array('is_numeric', time()),
  87. 'desc' => '',
  88. # 只有insert时才生效
  89. 'insert' => true,
  90. 'list' => 'date("Y-m-d H:i:s", {cdate})',
  91. ),
  92. ),
  93. # request 请求接口定义
  94. 'request' => array
  95. (
  96. 'key' => array
  97. (
  98. 'where' => array
  99. (
  100. 'key' => 'yes',
  101. ),
  102. 'type' => 'one',
  103. ),
  104. 'getOne' => array
  105. (
  106. 'where' => array
  107. (
  108. 'top_id' => 'yes',
  109. ),
  110. 'type' => 'one',
  111. 'order' => array('id', 'desc'),
  112. ),
  113. 'keyId' => array
  114. (
  115. 'where' => array
  116. (
  117. 'key' => 'yes',
  118. 'id' => array('yes', '!='),
  119. ),
  120. 'type' => 'one',
  121. ),
  122. # main 取所有子权限
  123. 'child' => array
  124. (
  125. 'where' => array
  126. (
  127. 'state' => 1,
  128. 'top_id' => array(1, '>='),
  129. ),
  130. 'type' => 'all',
  131. 'order' => array('id', 'desc'),
  132. 'col' => '*|top_id|key|',
  133. ),
  134. # main 取所有一级权限
  135. 'main' => array
  136. (
  137. 'where' => array
  138. (
  139. 'state' => 1,
  140. 'top_id' => -1,
  141. ),
  142. 'type' => 'all',
  143. 'order' => array('id', 'desc'),
  144. 'col' => '*|key',
  145. ),
  146. ),
  147. );