rule.php 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  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. $action = function()
  13. {
  14. $array = array();
  15. $info = Dever::db('score/action')->state();
  16. if($info)
  17. {
  18. $array += $info;
  19. }
  20. return $array;
  21. };
  22. $upper = array
  23. (
  24. 1 => '无上限',
  25. 2 => '有上限',
  26. );
  27. $upper_type = array
  28. (
  29. 1 => '按自然天-每天0点重置',
  30. 2 => '按小时',
  31. 3 => '永久',
  32. );
  33. return array
  34. (
  35. # 表名
  36. 'name' => 'rule',
  37. # 显示给用户看的名称
  38. 'lang' => '积分规则设置',
  39. 'order' => 10,
  40. 'menu' => false,
  41. # 数据结构
  42. 'struct' => array
  43. (
  44. 'id' => array
  45. (
  46. 'type' => 'int-11',
  47. 'name' => 'ID',
  48. 'default' => '',
  49. 'desc' => '',
  50. 'match' => 'is_numeric',
  51. ),
  52. 'config_id' => array
  53. (
  54. 'type' => 'int-11',
  55. 'name' => '积分名称',
  56. 'default' => '1',
  57. 'desc' => '积分名称',
  58. 'match' => 'is_numeric',
  59. 'update' => 'select',
  60. 'option' => $config,
  61. 'search' => 'select',
  62. 'list' => true,
  63. ),
  64. 'action_id' => array
  65. (
  66. 'type' => 'int-11',
  67. 'name' => '所属行为',
  68. 'default' => '1',
  69. 'desc' => '所属行为',
  70. 'match' => 'is_numeric',
  71. 'update' => 'select',
  72. 'option' => $action,
  73. 'search' => 'select',
  74. 'list' => true,
  75. ),
  76. 'num' => array
  77. (
  78. 'type' => 'varchar-80',
  79. 'name' => '增加积分数-如果为负数,则是减少积分',
  80. 'default' => '',
  81. 'desc' => '增加积分数',
  82. 'match' => 'option',
  83. 'update' => 'textarea',
  84. 'list' => true,
  85. ),
  86. 'upper' => array
  87. (
  88. 'type' => 'int-11',
  89. 'name' => '是否有上限限制',
  90. 'default' => '1',
  91. 'desc' => '是否有上限限制',
  92. 'match' => 'is_numeric',
  93. 'update' => 'select',
  94. 'option' => $upper,
  95. 'search' => 'select',
  96. 'control' => 'upper',
  97. ),
  98. 'upper_type' => array
  99. (
  100. 'type' => 'int-11',
  101. 'name' => '上限限制类型',
  102. 'default' => '1',
  103. 'desc' => '上限限制类型',
  104. 'match' => 'is_numeric',
  105. 'update' => 'select',
  106. 'option' => $upper_type,
  107. 'show' => 'upper=2',
  108. 'control' => 'upper_type',
  109. ),
  110. 'upper_time' => array
  111. (
  112. 'type' => 'int-11',
  113. 'name' => '间隔小时数',
  114. 'default' => '12',
  115. 'desc' => '间隔小时数',
  116. 'match' => 'option',
  117. 'update' => 'text',
  118. 'show' => 'upper_type=2'
  119. ),
  120. 'upper_limit' => array
  121. (
  122. 'type' => 'int-11',
  123. 'name' => '上限限制次数-小于1则不限制',
  124. 'default' => '2',
  125. 'desc' => '上限限制次数',
  126. 'match' => 'option',
  127. 'update' => 'text',
  128. 'show' => 'upper=2'
  129. ),
  130. 'state' => array
  131. (
  132. 'type' => 'tinyint-1',
  133. 'name' => '状态',
  134. 'default' => '1',
  135. 'desc' => '请选择状态',
  136. 'match' => 'is_numeric',
  137. ),
  138. 'cdate' => array
  139. (
  140. 'type' => 'int-11',
  141. 'name' => '录入时间',
  142. 'match' => array('is_numeric', time()),
  143. 'desc' => '',
  144. # 只有insert时才生效
  145. 'insert' => true,
  146. ),
  147. ),
  148. 'manage' => array
  149. (
  150. ),
  151. );