top.php 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  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 ? Dever::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' => 'is_numeric',
  78. ),
  79. 'cdate' => array
  80. (
  81. 'type' => 'int-11',
  82. 'name' => '录入时间',
  83. 'match' => array('is_numeric', time()),
  84. 'desc' => '',
  85. # 只有insert时才生效
  86. 'insert' => true,
  87. 'list' => 'date("Y-m-d H:i:s", {cdate})',
  88. ),
  89. ),
  90. # request 请求接口定义
  91. 'request' => array
  92. (
  93. 'key' => array
  94. (
  95. 'where' => array
  96. (
  97. 'key' => 'yes',
  98. ),
  99. 'type' => 'one',
  100. ),
  101. 'getOne' => array
  102. (
  103. 'where' => array
  104. (
  105. 'top_id' => 'yes',
  106. ),
  107. 'type' => 'one',
  108. 'order' => array('id', 'desc'),
  109. ),
  110. 'keyId' => array
  111. (
  112. 'where' => array
  113. (
  114. 'key' => 'yes',
  115. 'id' => array('yes', '!='),
  116. ),
  117. 'type' => 'one',
  118. ),
  119. # main 取所有子权限
  120. 'child' => array
  121. (
  122. 'where' => array
  123. (
  124. 'state' => 1,
  125. 'top_id' => array(1, '>='),
  126. ),
  127. 'type' => 'all',
  128. 'order' => array('id', 'desc'),
  129. 'col' => '*|top_id|key|',
  130. ),
  131. # main 取所有一级权限
  132. 'main' => array
  133. (
  134. 'where' => array
  135. (
  136. 'state' => 1,
  137. 'top_id' => -1,
  138. ),
  139. 'type' => 'all',
  140. 'order' => array('id', 'desc'),
  141. 'col' => '*|key',
  142. ),
  143. ),
  144. );