auth.php 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. <?php
  2. # 定义几个常用的选项
  3. $option = array
  4. (
  5. 1 => '生效',
  6. 2 => '失效',
  7. );
  8. return array
  9. (
  10. # 表名
  11. 'name' => 'auth',
  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. 'project' => array
  28. (
  29. 'type' => 'varchar-50',
  30. 'name' => '项目key',
  31. 'default' => '',
  32. 'desc' => '请输入项目key',
  33. 'match' => 'is_string',
  34. 'update' => 'text',
  35. 'list' => true,
  36. ),
  37. 'project_name' => array
  38. (
  39. 'type' => 'varchar-50',
  40. 'name' => '项目名',
  41. 'default' => '',
  42. 'desc' => '请输入项目名',
  43. 'match' => 'is_string',
  44. 'update' => 'text',
  45. 'search' => 'order,fulltext',
  46. 'list' => true,
  47. ),
  48. 'name' => array
  49. (
  50. 'type' => 'varchar-50',
  51. 'name' => '权限名',
  52. 'default' => '',
  53. 'desc' => '请输入权限名',
  54. 'match' => 'is_string',
  55. 'update' => 'text',
  56. 'search' => 'order,fulltext',
  57. 'list' => true,
  58. ),
  59. 'auth_id' => array
  60. (
  61. 'type' => 'int-11',
  62. 'name' => '上级权限',
  63. 'default' => '-1',
  64. 'desc' => '请选择上级权限',
  65. 'match' => 'is_numeric',
  66. 'update' => 'select',
  67. 'search' => 'order,select',
  68. 'list' => '{auth_id} > 0 ? Dever::load("manage/auth-one#name", {auth_id}) : "父级权限"',
  69. ),
  70. 'key' => array
  71. (
  72. 'type' => 'varchar-100',
  73. 'name' => '权限key',
  74. 'default' => '',
  75. 'desc' => '请输入权限key',
  76. 'match' => 'is_string',
  77. 'update' => 'text',
  78. 'search' => 'fulltext',
  79. 'list' => true,
  80. ),
  81. 'value' => array
  82. (
  83. 'type' => 'varchar-30',
  84. 'name' => '对应的值',
  85. 'default' => '',
  86. 'desc' => '请输入对应的值',
  87. 'match' => 'is_string',
  88. 'update' => 'text',
  89. 'search' => 'fulltext',
  90. 'list' => true,
  91. ),
  92. 'state' => array
  93. (
  94. 'type' => 'tinyint-1',
  95. 'name' => '状态',
  96. 'default' => '1',
  97. 'desc' => '请选择状态',
  98. 'match' => array('is_numeric', 1),
  99. 'option' => $option,
  100. 'update' => 'radio',
  101. 'list' => true,
  102. ),
  103. 'cdate' => array
  104. (
  105. 'type' => 'int-11',
  106. 'name' => '录入时间',
  107. 'match' => array('is_numeric', time()),
  108. 'desc' => '',
  109. # 只有insert时才生效
  110. 'insert' => true,
  111. 'list' => 'date("Y-m-d H:i:s", {cdate})',
  112. ),
  113. ),
  114. # request 请求接口定义
  115. 'request' => array
  116. (
  117. 'key' => array
  118. (
  119. 'where' => array
  120. (
  121. 'key' => 'yes',
  122. ),
  123. 'type' => 'one',
  124. ),
  125. 'project' => array
  126. (
  127. 'where' => array
  128. (
  129. 'state' => 1,
  130. ),
  131. 'type' => 'all',
  132. 'group' => 'project',
  133. ),
  134. # main 取所有主栏目
  135. 'main' => array
  136. (
  137. 'where' => array
  138. (
  139. 'auth_id' => -1,
  140. 'state' => 1,
  141. ),
  142. 'type' => 'all',
  143. 'order' => array('id', 'desc'),
  144. 'col' => '*|project|id|',
  145. ),
  146. # 取所有下级栏目
  147. 'child' => array
  148. (
  149. 'where' => array
  150. (
  151. 'auth_id' => array('1', '>='),
  152. 'state' => 1,
  153. ),
  154. 'type' => 'all',
  155. 'order' => array('id', 'desc'),
  156. 'col' => '*|auth_id|id|',
  157. ),
  158. )
  159. );