level.php 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. <?php
  2. $config = function()
  3. {
  4. $array = array();
  5. $info = Dever::db('score/config')->state();
  6. if($info)
  7. {
  8. $array += $info;
  9. }
  10. return $array;
  11. };
  12. $type_id = function()
  13. {
  14. $array = array();
  15. $info = Dever::db('score/level_type')->state();
  16. if($info)
  17. {
  18. $array += $info;
  19. }
  20. return $array;
  21. };
  22. $total_type = array
  23. (
  24. 1 => '限制总数',
  25. 2 => '不限制',
  26. );
  27. return array
  28. (
  29. # 表名
  30. 'name' => 'level',
  31. # 显示给用户看的名称
  32. 'lang' => '积分等级设置',
  33. # 后台菜单排序
  34. 'order' => 8,
  35. 'check' => 'level',
  36. 'desc' => '等级根据积分来升级,积分通过用户行为来生成,如果本项目有多个用户等级,如有声望等级、金币等级、普通用户等级、VIP用户等级,请设置等级类别,否则不需要设置',
  37. # 数据结构
  38. 'struct' => array
  39. (
  40. 'id' => array
  41. (
  42. 'type' => 'int-11',
  43. 'name' => 'ID',
  44. 'default' => '',
  45. 'desc' => '',
  46. 'match' => 'is_numeric',
  47. 'search' => 'order',
  48. //'list' => true,
  49. //'order' => 'desc',
  50. ),
  51. 'name' => array
  52. (
  53. 'type' => 'varchar-32',
  54. 'name' => '等级名称',
  55. 'default' => '',
  56. 'desc' => '请输入名称',
  57. 'match' => 'is_string',
  58. 'update' => 'text',
  59. 'search' => 'fulltext',
  60. 'list' => true,
  61. ),
  62. 'level_type_id' => array
  63. (
  64. 'type' => 'int-11',
  65. 'name' => '等级类别',
  66. 'default' => '1',
  67. 'desc' => '等级类别',
  68. 'match' => 'is_numeric',
  69. 'update' => 'select',
  70. 'option' => $type_id,
  71. 'search' => 'select',
  72. 'list' => true,
  73. ),
  74. 'score' => array
  75. (
  76. 'type' => 'text-1000',
  77. 'name' => '积分设置',
  78. 'default' => '',
  79. 'desc' => '积分设置',
  80. 'match' => 'is_string',
  81. 'update' => array
  82. (
  83. array
  84. (
  85. 'col' => 'config',
  86. 'name' => '积分名称',
  87. 'default' => '',
  88. 'desc' => '积分名称',
  89. 'match' => 'is_string',
  90. 'update' => 'select',
  91. 'option' => $config,
  92. ),
  93. array
  94. (
  95. 'col' => 'num',
  96. 'name' => '所需积分数',
  97. 'default' => '0',
  98. 'desc' => '所需积分数',
  99. 'match' => 'is_string',
  100. 'update' => 'text',
  101. ),
  102. ),
  103. ),
  104. 'level' => array
  105. (
  106. 'type' => 'int-11',
  107. 'name' => '等级数字-请直接输入等级数字,每次升级按照该数字进行匹配,如果设置为1,则为lv1,不允许重复',
  108. 'default' => '1',
  109. 'desc' => '等级数字',
  110. 'match' => 'option',
  111. 'update' => 'text',
  112. 'search' => 'order',
  113. 'list' => true,
  114. 'order' => 'desc',
  115. 'edit' => true,
  116. ),
  117. 'total_type' => array
  118. (
  119. 'type' => 'tinyint-1',
  120. 'name' => '是否限制当前级别的总数-如果限制,请填写限制的总数,升级的用户数不能超过该数量',
  121. 'default' => '2',
  122. 'desc' => '是否限制当前级别的总数',
  123. 'match' => 'is_numeric',
  124. 'update' => 'select',
  125. 'option' => $total_type,
  126. 'search' => 'select',
  127. 'control' => 'total_type',
  128. ),
  129. 'total' => array
  130. (
  131. 'type' => 'int-11',
  132. 'name' => '限制总数',
  133. 'default' => '0',
  134. 'desc' => '限制总数',
  135. 'match' => 'option',
  136. 'update' => 'text',
  137. 'show' => 'total_type=1',
  138. ),
  139. 'state' => array
  140. (
  141. 'type' => 'tinyint-1',
  142. 'name' => '状态',
  143. 'default' => '1',
  144. 'desc' => '请选择状态',
  145. 'match' => 'is_numeric',
  146. ),
  147. 'cdate' => array
  148. (
  149. 'type' => 'int-11',
  150. 'name' => '录入时间',
  151. 'match' => array('is_numeric', time()),
  152. 'desc' => '',
  153. # 只有insert时才生效
  154. 'insert' => true,
  155. 'list' => 'date("Y-m-d H:i:s", {cdate})',
  156. ),
  157. ),
  158. 'manage' => array
  159. (
  160. # 自定义快捷新增和编辑
  161. 'button' => array
  162. (
  163. '等级类别' => array('list', 'level_type&project=score&oper_parent=level&oper_project=score'),
  164. ),
  165. ),
  166. 'request' => array
  167. (
  168. ),
  169. );