rule.php 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243
  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. $rebate_type = array
  34. (
  35. 1 => '无返利',
  36. 2 => '百分比',
  37. 3 => '数值',
  38. );
  39. $rebate_config = function()
  40. {
  41. $array = array
  42. (
  43. -1 => array
  44. (
  45. 'id' => -1,
  46. 'name' => '当前积分',
  47. ),
  48. );
  49. $info = Dever::db('score/config')->state();
  50. if($info)
  51. {
  52. $array += $info;
  53. }
  54. return $array;
  55. };
  56. return array
  57. (
  58. # 表名
  59. 'name' => 'rule',
  60. # 显示给用户看的名称
  61. 'lang' => '积分规则设置',
  62. 'order' => 10,
  63. 'menu' => false,
  64. # 数据结构
  65. 'struct' => array
  66. (
  67. 'id' => array
  68. (
  69. 'type' => 'int-11',
  70. 'name' => 'ID',
  71. 'default' => '',
  72. 'desc' => '',
  73. 'match' => 'is_numeric',
  74. ),
  75. 'config_id' => array
  76. (
  77. 'type' => 'int-11',
  78. 'name' => '积分名称',
  79. 'default' => '1',
  80. 'desc' => '积分名称',
  81. 'match' => 'is_numeric',
  82. 'update' => 'select',
  83. 'option' => $config,
  84. 'search' => 'select',
  85. 'list' => true,
  86. ),
  87. 'action_id' => array
  88. (
  89. 'type' => 'int-11',
  90. 'name' => '所属行为',
  91. 'default' => '1',
  92. 'desc' => '所属行为',
  93. 'match' => 'is_numeric',
  94. 'update' => 'select',
  95. 'option' => $action,
  96. 'search' => 'select',
  97. 'list' => true,
  98. ),
  99. 'num' => array
  100. (
  101. 'type' => 'varchar-80',
  102. 'name' => '增加积分数-如果为负数,则是减少积分',
  103. 'default' => '',
  104. 'desc' => '增加积分数',
  105. 'match' => 'option',
  106. 'update' => 'textarea',
  107. 'list' => true,
  108. ),
  109. 'num' => array
  110. (
  111. 'type' => 'varchar-80',
  112. 'name' => '增加积分数-如果为负数,则是减少积分',
  113. 'default' => '',
  114. 'desc' => '增加积分数',
  115. 'match' => 'option',
  116. 'update' => 'textarea',
  117. 'list' => true,
  118. ),
  119. 'upper' => array
  120. (
  121. 'type' => 'int-11',
  122. 'name' => '是否有上限限制',
  123. 'default' => '1',
  124. 'desc' => '是否有上限限制',
  125. 'match' => 'is_numeric',
  126. 'update' => 'select',
  127. 'option' => $upper,
  128. 'search' => 'select',
  129. 'control' => 'upper',
  130. ),
  131. 'upper_type' => array
  132. (
  133. 'type' => 'int-11',
  134. 'name' => '上限限制类型',
  135. 'default' => '1',
  136. 'desc' => '上限限制类型',
  137. 'match' => 'is_numeric',
  138. 'update' => 'select',
  139. 'option' => $upper_type,
  140. 'show' => 'upper=2',
  141. 'control' => 'upper_type',
  142. ),
  143. 'upper_time' => array
  144. (
  145. 'type' => 'int-11',
  146. 'name' => '间隔小时数',
  147. 'default' => '12',
  148. 'desc' => '间隔小时数',
  149. 'match' => 'option',
  150. 'update' => 'text',
  151. 'show' => 'upper_type=2'
  152. ),
  153. 'upper_limit' => array
  154. (
  155. 'type' => 'int-11',
  156. 'name' => '上限限制次数-小于1则不限制',
  157. 'default' => '2',
  158. 'desc' => '上限限制次数',
  159. 'match' => 'option',
  160. 'update' => 'text',
  161. 'show' => 'upper=2'
  162. ),
  163. 'rebate_type' => array
  164. (
  165. 'type' => 'tinyint-1',
  166. 'name' => '返利设置',
  167. 'default' => '1',
  168. 'desc' => '返利设置',
  169. 'match' => 'option',
  170. 'update' => 'radio',
  171. 'option' => $rebate_type,
  172. 'list' => true,
  173. 'search' => 'select',
  174. 'control' => 'rebate_type',
  175. ),
  176. 'rebate_config_id' => array
  177. (
  178. 'type' => 'int-11',
  179. 'name' => '返利积分名称',
  180. 'default' => '-1',
  181. 'desc' => '返利积分名称',
  182. 'match' => 'is_numeric',
  183. 'update' => 'select',
  184. 'option' => $rebate_config,
  185. 'search' => 'select',
  186. 'list' => true,
  187. 'show' => 'rebate_type=2,3',
  188. ),
  189. 'rebate_value' => array
  190. (
  191. 'type' => 'varchar-500',
  192. 'name' => '返利积分数-如果是百分比类型,这里如果填的是10,那就是当前获得积分数的10%。直接填写数字就是当前用户的上级(1级)返利,支持多层层级设置,1:20,2:30 就是1级202级30,同时也支持0级',
  193. 'default' => '',
  194. 'desc' => '返利积分数',
  195. 'match' => 'is_string',
  196. 'update' => 'textarea',
  197. 'list' => true,
  198. 'show' => 'rebate_type=2,3',
  199. ),
  200. 'state' => array
  201. (
  202. 'type' => 'tinyint-1',
  203. 'name' => '状态',
  204. 'default' => '1',
  205. 'desc' => '请选择状态',
  206. 'match' => 'is_numeric',
  207. ),
  208. 'cdate' => array
  209. (
  210. 'type' => 'int-11',
  211. 'name' => '录入时间',
  212. 'match' => array('is_numeric', time()),
  213. 'desc' => '',
  214. # 只有insert时才生效
  215. 'insert' => true,
  216. ),
  217. ),
  218. 'manage' => array
  219. (
  220. ),
  221. );