user_level.php 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. <?php
  2. $level = function()
  3. {
  4. $array = array
  5. (
  6. -1 => array
  7. (
  8. 'id' => -1,
  9. 'name' => '无',
  10. ),
  11. );
  12. $info = Dever::db('score/level')->state();
  13. if($info)
  14. {
  15. $array += $info;
  16. }
  17. return $array;
  18. };
  19. $type_id = function()
  20. {
  21. $array = array();
  22. $info = Dever::db('score/level_type')->state();
  23. if($info)
  24. {
  25. $array += $info;
  26. }
  27. return $array;
  28. };
  29. $level_status = array
  30. (
  31. 1 => '可以升级',
  32. 2 => '不可升级',
  33. );
  34. return array
  35. (
  36. # 表名
  37. 'name' => 'user_level',
  38. # 显示给用户看的名称
  39. 'lang' => '用户积分等级',
  40. 'order' => 99,
  41. 'menu' => 'passport',
  42. 'menu' => false,
  43. # 数据结构
  44. 'struct' => array
  45. (
  46. 'id' => array
  47. (
  48. 'type' => 'int-11',
  49. 'name' => 'ID',
  50. 'default' => '',
  51. 'desc' => '',
  52. 'match' => 'is_numeric',
  53. ),
  54. 'uid' => array
  55. (
  56. 'type' => 'int-11',
  57. 'name' => '用户名',
  58. 'default' => '0',
  59. 'desc' => '请选择用户',
  60. 'match' => 'is_numeric',
  61. //'update' => 'select',
  62. //'search' => 'select',
  63. 'search' => array
  64. (
  65. 'api' => 'passport/user-all',
  66. 'col' => 'username',
  67. 'result' => 'id',
  68. ),
  69. 'list' => '{uid} > 0 ? Dever::load("passport/user-one#username", {uid}) : "匿名用户"',
  70. ),
  71. 'level_type_id' => array
  72. (
  73. 'type' => 'int-11',
  74. 'name' => '等级类别',
  75. 'default' => '1',
  76. 'desc' => '等级类别',
  77. 'match' => 'is_numeric',
  78. 'update' => 'select',
  79. 'option' => $type_id,
  80. 'search' => 'select',
  81. 'list' => true,
  82. ),
  83. 'level_id' => array
  84. (
  85. 'type' => 'int-11',
  86. 'name' => '等级名称',
  87. 'default' => '-1',
  88. 'desc' => '等级名称',
  89. 'match' => 'is_numeric',
  90. 'update' => 'select',
  91. 'option' => $level,
  92. 'search' => 'select',
  93. 'list' => true,
  94. 'edit' => true,
  95. ),
  96. 'next_level_id' => array
  97. (
  98. 'type' => 'int-11',
  99. 'name' => '下级等级',
  100. 'default' => '-1',
  101. 'desc' => '下级等级',
  102. 'match' => 'is_numeric',
  103. ),
  104. 'type' => array
  105. (
  106. 'type' => 'int-11',
  107. 'name' => '升级方式',
  108. 'default' => '1',
  109. 'desc' => '升级方式',
  110. 'match' => 'is_numeric',
  111. //'update' => 'select',
  112. //'option' => $type,
  113. //'search' => 'select',
  114. //'list' => true,
  115. //'edit' => true,
  116. ),
  117. 'level_status' => array
  118. (
  119. 'type' => 'int-11',
  120. 'name' => '是否可以升级',
  121. 'default' => '2',
  122. 'desc' => '是否可以升级',
  123. 'match' => 'is_numeric',
  124. //'update' => 'select',
  125. 'option' => $level_status,
  126. //'search' => 'select',
  127. //'list' => true,
  128. //'edit' => true,
  129. ),
  130. 'info' => array
  131. (
  132. 'type' => 'varchar-300',
  133. 'name' => '备注',
  134. 'default' => '',
  135. 'desc' => '备注',
  136. 'match' => 'option',
  137. 'update' => 'textarea',
  138. //'show' => 'status=5'
  139. 'list' => '"{info}" ? "{info}" : "双击添加备注"',
  140. 'edit' => true,
  141. ),
  142. 'cdate' => array
  143. (
  144. 'type' => 'int-11',
  145. 'name' => '录入时间',
  146. 'match' => array('is_numeric', time()),
  147. 'desc' => '',
  148. # 只有insert时才生效
  149. 'insert' => true,
  150. ),
  151. ),
  152. 'manage' => array
  153. (
  154. 'delete' => false,
  155. 'edit' => false,
  156. 'insert' => false,
  157. ),
  158. );