role_reward.php 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259
  1. <?php
  2. $role = function()
  3. {
  4. $info = Dever::db('setting/role')->select();
  5. return $info;
  6. };
  7. $value_type = array
  8. (
  9. 1 => '百分比',
  10. 2 => '数值',
  11. );
  12. $is_give = array
  13. (
  14. 1 => '是',
  15. 2 => '否',
  16. );
  17. $prize = function()
  18. {
  19. $info = Dever::db('setting/prize')->select();
  20. return $info;
  21. };
  22. $role_id = Dever::input('search_option_role_id');
  23. $update = false;
  24. $value = '3,4';
  25. if ($role_id) {
  26. $role_info = Dever::db('setting/role')->find($role_id);
  27. if ($role_info && $role_info['type'] == 2 && $role_info['area'] < 3) {
  28. if ($role_info['area'] == 2) {
  29. $value = '4';
  30. }
  31. $update = 'text';
  32. }
  33. }
  34. return array
  35. (
  36. # 表名
  37. 'name' => 'role_reward',
  38. # 显示给用户看的名称
  39. 'lang' => '直推奖励管理',
  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. 'search' => 'order',
  52. 'update' => 'hidden',
  53. //'list' => true,
  54. ),
  55. 'role_id' => array
  56. (
  57. 'type' => 'int-11',
  58. 'name' => '代理商角色',
  59. 'default' => '',
  60. 'desc' => '代理商角色',
  61. 'match' => 'is_numeric',
  62. 'update' => 'hidden',
  63. 'search' => 'hidden',
  64. 'value' => $role_id,
  65. 'list' => 'Dever::load("setting/role-one#name", {role_id})',
  66. ),
  67. 't_role_id' => array
  68. (
  69. 'type' => 'int-11',
  70. 'name' => '推荐角色',
  71. 'default' => '',
  72. 'desc' => '推荐角色',
  73. 'match' => 'is_numeric',
  74. 'update' => 'radio',
  75. 'search' => 'select',
  76. 'option' => $role,
  77. 'list' => 'Dever::load("setting/role-one#name", {t_role_id})',
  78. 'control' => 't_role_id',
  79. ),
  80. 'num' => array
  81. (
  82. 'type' => 'int-11',
  83. 'name' => '推荐个数-每推荐多少个,奖励多少数值,这里填写推荐个数',
  84. 'default' => '1',
  85. 'desc' => '推荐个数',
  86. 'match' => 'is_numeric',
  87. 'update' => 'text',
  88. 'list' => true,
  89. ),
  90. 'value' => array
  91. (
  92. 'type' => 'varchar-32',
  93. 'name' => '推荐奖励数值-如果是百分比,这里输入10,就是奖励10%,如果是数值,这里以元为单位',
  94. 'default' => '0',
  95. 'desc' => '推荐奖励数值',
  96. 'match' => 'is_string',
  97. 'update' => 'text',
  98. 'search' => 'fulltext',
  99. 'list' => true,
  100. ),
  101. 'zt_qn_value' => array
  102. (
  103. 'type' => 'varchar-32',
  104. 'name' => '直推区内数值-规则同上,仅限区县和城市代理有效',
  105. 'default' => '0',
  106. 'desc' => '直推区内数值',
  107. 'match' => 'is_string',
  108. 'update' => $update,
  109. 'show' => 't_role_id=' . $value,
  110. //'search' => 'fulltext',
  111. //'list' => true,
  112. ),
  113. 'zt_qw_value' => array
  114. (
  115. 'type' => 'varchar-32',
  116. 'name' => '直推区外数值-规则同上,仅限区县和城市代理有效',
  117. 'default' => '0',
  118. 'desc' => '直推区外数值',
  119. 'match' => 'is_string',
  120. 'update' => $update,
  121. 'show' => 't_role_id=' . $value,
  122. //'search' => 'fulltext',
  123. //'list' => true,
  124. ),
  125. 'fzt_qn_value' => array
  126. (
  127. 'type' => 'varchar-32',
  128. 'name' => '非直推区内数值-规则同上,仅限区县和城市代理有效,如果是城市代理,这里可以填写两个数值,用半角逗号隔开,第一个是区县数值,第二个是街道数值',
  129. 'default' => '0',
  130. 'desc' => '非直推区内数值',
  131. 'match' => 'is_string',
  132. 'update' => $update,
  133. 'show' => 't_role_id=' . $value,
  134. //'search' => 'fulltext',
  135. //'list' => true,
  136. ),
  137. 'value_type' => array
  138. (
  139. 'type' => 'tinyint-1',
  140. 'name' => '奖励数值类型',
  141. 'default' => '1',
  142. 'desc' => '奖励数值类型',
  143. 'match' => 'is_numeric',
  144. 'update' => 'radio',
  145. 'option' => $value_type,
  146. 'search' => 'select',
  147. 'list' => true,
  148. 'control' => 'type',
  149. ),
  150. 'is_give' => array
  151. (
  152. 'type' => 'tinyint-1',
  153. 'name' => '是否有额外奖励',
  154. 'default' => '2',
  155. 'desc' => '是否有额外奖励',
  156. 'match' => 'is_numeric',
  157. //'update' => 'radio',
  158. 'option' => $is_give,
  159. 'control' => 'is_give',
  160. ),
  161. 'give' => array
  162. (
  163. 'type' => 'text-1000',
  164. 'name' => '额外奖励',
  165. 'default' => '',
  166. 'desc' => '额外奖励',
  167. 'match' => 'is_string',
  168. 'show' => 'is_give=1',
  169. 'updates' => array
  170. (
  171. array
  172. (
  173. 'col' => 'num',
  174. 'name' => '推荐个数',
  175. 'default' => '0',
  176. 'desc' => '推荐个数',
  177. 'match' => 'is_string',
  178. 'update' => 'text',
  179. ),
  180. array
  181. (
  182. 'col' => 'type',
  183. 'name' => '奖励类型',
  184. 'default' => '1',
  185. 'desc' => '奖励类型',
  186. 'match' => 'is_string',
  187. 'update' => 'select',
  188. 'option' => $prize,
  189. ),
  190. array
  191. (
  192. 'col' => 'value',
  193. 'name' => '奖励数值',
  194. 'default' => '0',
  195. 'desc' => '奖励数值',
  196. 'match' => 'is_string',
  197. 'update' => 'text',
  198. ),
  199. ),
  200. ),
  201. 'state' => array
  202. (
  203. 'type' => 'tinyint-1',
  204. 'name' => '状态',
  205. 'default' => '1',
  206. 'desc' => '请选择状态',
  207. 'match' => 'is_numeric',
  208. ),
  209. 'cdate' => array
  210. (
  211. 'type' => 'int-11',
  212. 'name' => '创建时间',
  213. 'match' => array('is_numeric', time()),
  214. 'desc' => '',
  215. # 只有insert时才生效
  216. //'insert' => true,
  217. 'search' => 'date',
  218. 'list' => 'date("Y-m-d H:i:s", {cdate})',
  219. ),
  220. ),
  221. 'manage' => array
  222. (
  223. 'list_button' => array
  224. (
  225. //'location1' => array('权益设置', Dever::url('lib/reward_set.home', 'agent')),
  226. 'list' => array('额外奖励', '"role_reward_give&search_option_reward_id={id}&search_option_role_id={role_id}&oper_table=role_reward&oper_parent=role_reward&top_table=role"'),
  227. )
  228. ),
  229. 'request' => array
  230. (
  231. ),
  232. );