BonusPoolSetting.php 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468
  1. <?php
  2. /**
  3. * 重庆赤晓店信息科技有限公司
  4. * https://www.chixiaodian.com
  5. * Copyright (c) 2023 赤店商城 All rights reserved.
  6. */
  7. namespace app\modules\admin\models;
  8. use app\models\CashExt;
  9. use app\models\Level;
  10. use app\models\ShareHolderLevel;
  11. use yii\base\Model;
  12. use app\models\Option;
  13. use app\utils\FuGou;
  14. class BonusPoolSetting extends Model
  15. {
  16. public $store_id;
  17. public $shareHolderTeamRewardPlatformBears;
  18. public $shareHolderRewardPointRate;
  19. public $shareHolderFrostSendCond;
  20. public $dividends_method;
  21. public $cycle;
  22. public $is_open_share;
  23. public $is_open_range;
  24. public $is_open_area;
  25. public $team_num;
  26. public $qrcode;
  27. public $range_name;
  28. public $holder_name;
  29. public $area_name;
  30. public $old_range_name;
  31. public $direct_range_name;
  32. public $old_add_holder_name;
  33. public $shareHolderProfit;
  34. public $shareHolderPriceMin;
  35. public $shareHolderCashProfit;
  36. public $shareHolderLevel;
  37. public $shareHolderNumber;
  38. public $shareHolderHasCheck;
  39. public $pay_wechat;
  40. public $pay_alipay;
  41. public $bank;
  42. public $remaining_sum;
  43. public $lg;
  44. public $cash_max_day;
  45. public $cash_max_single_day;
  46. public $min_money;
  47. public $auto_money;
  48. public $dividends_condition;
  49. public $shareHolderProfitSwitch;
  50. public $shareHolderHighProfit;
  51. public $shareHolderAliasName;
  52. public $shareHolderRepeatProfitSwitch;
  53. public $shareHolderJiandian;
  54. //客户需求‘滑落’
  55. public $shareHolderChangeOldParentSwitch;//滑落开关
  56. public $shareHolderChangeOldParentNumber;//滑落人数
  57. public $shareHolderChangeChildMinNumber;//滑落人数
  58. public $userSlippedOnceSwitch;//单用户只允许滑落一次开关
  59. // 复购
  60. public $fugou;
  61. public $userLevel;
  62. //提现
  63. public $cash_price_type;//提现佣金到账类型
  64. public $cash_price_amount;//提现佣金现金比例
  65. public $cash_price_integral;//提现佣金积分比例
  66. public $cash_price_balance;//提现佣金余额比例
  67. //高等级是否参与加权平均
  68. public $high_level_join_average;
  69. // 直推团队收益发放层级
  70. public $shareHolderPriceLevel;
  71. /**
  72. * @return array
  73. */
  74. public function rules()
  75. {
  76. return [
  77. [['cycle', 'is_open_share', 'is_open_range', 'is_open_area', 'team_num', 'store_id', 'shareHolderProfitSwitch', 'shareHolderRepeatProfitSwitch', 'shareHolderJiandian', 'shareHolderChangeOldParentSwitch', 'high_level_join_average'], 'integer'],
  78. // [['cycle', 'is_open_share', 'is_open_range', 'is_open_area'], 'default', 'value' => 0],
  79. // [['team_num'], 'default', 'value' => 3],
  80. [['range_name', 'holder_name', 'area_name', 'old_range_name', 'direct_range_name', 'old_add_holder_name', 'shareHolderAliasName', 'cash_price_type'], 'string', 'max' => 255],
  81. [['qrcode', 'shareHolderNumber'], 'string'],
  82. // [['shareHolderProfit', 'dividends_condition'], 'default', 'value' => 0],
  83. [['shareHolderProfit', 'shareHolderCashProfit', 'shareHolderLevel', 'shareHolderHasCheck',
  84. 'pay_wechat', 'pay_alipay', 'bank', 'lg', 'remaining_sum', 'cash_max_day', 'min_money', 'shareHolderPriceMin', 'dividends_condition', 'shareHolderHighProfit', 'cash_max_single_day',
  85. 'shareHolderChangeOldParentNumber', 'shareHolderChangeChildMinNumber', 'userSlippedOnceSwitch', 'userLevel', 'cash_price_amount', 'cash_price_integral', 'cash_price_balance', 'shareHolderPriceLevel'], 'number'],
  86. [['fugou'], 'safe'],
  87. [['shareHolderTeamRewardPlatformBears', 'shareHolderRewardPointRate', 'shareHolderFrostSendCond', 'dividends_method'], 'safe'],
  88. [['auto_money'], 'safe'],
  89. ];
  90. }
  91. public function attributeLabels()
  92. {
  93. return [
  94. 'shareHolderTeamRewardPlatformBears' => '是否平台承担平级奖',
  95. 'shareHolderRewardPointRate' => '发放积分占比佣金百分比',
  96. 'shareHolderFrostSendCond' => '帮扶佣金解冻条件',
  97. 'dividends_method' => '分红方式',
  98. 'cycle' => '奖金池周期',
  99. 'is_open_share' => '是否开启股东分红',
  100. 'is_open_range' => '是否开启极差分红',
  101. 'is_open_area' => '是否开启区域分红',
  102. 'team_num' => '团队层数',
  103. 'qrcode' => '二维码相关',
  104. 'range_name' => '极差分红',
  105. 'holder_name' => '股东分红',
  106. 'area_name' => '区域分红',
  107. 'old_range_name' => '极差分红(原关系)',
  108. 'direct_range_name' => '2+1直推团队收益比例',
  109. 'old_add_holder_name' => '2+1直推团队收益比例(原关系)',
  110. 'shareHolderProfit' => '冻结佣金配置',
  111. 'shareHolderPriceMin' => '停止基数(分红金额小于此即停止递归分红)',
  112. 'shareHolderCashProfit' => '佣金提现手续费比例',
  113. 'shareHolderLevel' => '冻结等级',
  114. 'shareHolderNumber' => '冻结层数',
  115. 'shareHolderHasCheck' => '是否开启股东审核',
  116. 'pay_wechat' => '提现方式微信',
  117. 'pay_alipay' => '提现方式支付宝',
  118. 'bank' => '提现方式银行卡',
  119. 'remaining_sum' => '提现方式余额',
  120. 'lg' => '提现方式灵工',
  121. 'cash_max_day' => '每日上限',
  122. 'min_money' => '最少提现',
  123. 'auto_money'=>'自动发放以内的金额',
  124. 'dividends_condition' => '分红条件',
  125. 'shareHolderProfitSwitch' => '小推大佣金限制',
  126. 'cash_max_single_day' => '每人每日提现上限',
  127. 'shareHolderAliasName' => '股东别名',
  128. 'shareHolderRepeatProfitSwitch' => '小推大复购佣金限制',
  129. 'shareHolderJiandian' => '见点奖发放层级',
  130. 'shareHolderChangeOldParentSwitch' => '滑落开关',
  131. 'shareHolderChangeOldParentNumber' => '滑落人数',
  132. 'shareHolderChangeChildMinNumber' => '直推最低人数',
  133. 'userSlippedOnceSwitch' => '单用户只允许滑落一次开关',
  134. 'userLevel' => '会员等级',
  135. 'cash_price_type' => '提现佣金到账类型',
  136. 'cash_price_amount' => '提现佣金现金比例',
  137. 'cash_price_integral' => '提现佣金积分比例',
  138. 'cash_price_balance' => '提现佣金余额比例',
  139. 'high_level_join_average' => '是否开启高等级是否参与加权平均',
  140. 'shareHolderPriceLevel' => '直推团队收益发放层级'
  141. ];
  142. }
  143. public function save()
  144. {
  145. if (!$this->validate()) {
  146. return [
  147. 'code' => 1,
  148. 'msg' => $this->getErrorSummary(false)[0],
  149. ];
  150. }
  151. $name = [];
  152. $val = [];
  153. isset($this->shareHolderTeamRewardPlatformBears) && ($name = array_merge($name, ['shareHolderTeamRewardPlatformBears'])) && ($val = array_merge($val, [$this->shareHolderTeamRewardPlatformBears]));
  154. isset($this->shareHolderRewardPointRate) && ($name = array_merge($name, ['shareHolderRewardPointRate'])) && ($val = array_merge($val, [$this->shareHolderRewardPointRate]));
  155. isset($this->shareHolderFrostSendCond) && ($name = array_merge($name, ['shareHolderFrostSendCond'])) && ($val = array_merge($val, [$this->shareHolderFrostSendCond]));
  156. isset($this->dividends_method) && ($name = array_merge($name, ['dividends_method'])) && ($val = array_merge($val, [$this->dividends_method]));
  157. isset($this->is_open_share) && ($name = array_merge($name, ['is_open_share'])) && ($val = array_merge($val, [$this->is_open_share]));
  158. isset($this->is_open_range) && ($name = array_merge($name, ['is_open_range'])) && ($val = array_merge($val, [$this->is_open_range]));
  159. isset($this->team_num) && ($name = array_merge($name, ['team_num'])) && ($val = array_merge($val, [$this->team_num]));
  160. isset($this->range_name) && ($name = array_merge($name, ['range_name'])) && ($val = array_merge($val, [$this->range_name]));
  161. isset($this->holder_name) && ($name = array_merge($name, ['holder_name'])) && ($val = array_merge($val, [$this->holder_name]));
  162. isset($this->qrcode) && ($name = array_merge($name, ['qrcode'])) && ($val = array_merge($val, [$this->qrcode]));
  163. isset($this->area_name) && ($name = array_merge($name, ['area_name'])) && ($val = array_merge($val, [$this->area_name]));
  164. isset($this->is_open_area) && ($name = array_merge($name, ['is_open_area'])) && ($val = array_merge($val, [$this->is_open_area]));
  165. isset($this->shareHolderProfit) && ($name = array_merge($name, ['shareHolderProfit'])) && ($val = array_merge($val, [$this->shareHolderProfit]));
  166. isset($this->shareHolderPriceMin) && ($name = array_merge($name, ['shareHolderPriceMin'])) && ($val = array_merge($val, [$this->shareHolderPriceMin]));
  167. // 直推团队收益发放层级
  168. isset($this->shareHolderPriceLevel) && ($name = array_merge($name, ['shareHolderPriceLevel'])) && ($val = array_merge($val, [$this->shareHolderPriceLevel]));
  169. isset($this->shareHolderCashProfit) && ($name = array_merge($name, ['shareHolderCashProfit'])) && ($val = array_merge($val, [$this->shareHolderCashProfit]));
  170. isset($this->shareHolderLevel) && ($name = array_merge($name, ['shareHolderLevel'])) && ($val = array_merge($val, [$this->shareHolderLevel]));
  171. isset($this->shareHolderNumber) && ($name = array_merge($name, ['shareHolderNumber'])) && ($val = array_merge($val, [$this->shareHolderNumber]));
  172. isset($this->shareHolderHasCheck) && ($name = array_merge($name, ['shareHolderHasCheck'])) && ($val = array_merge($val, [$this->shareHolderHasCheck]));
  173. isset($this->pay_wechat) && ($name = array_merge($name, ['pay_wechat'])) && ($val = array_merge($val, [$this->pay_wechat]));
  174. isset($this->pay_alipay) && ($name = array_merge($name, ['pay_alipay'])) && ($val = array_merge($val, [$this->pay_alipay]));
  175. isset($this->bank) && ($name = array_merge($name, ['bank'])) && ($val = array_merge($val, [$this->bank]));
  176. isset($this->remaining_sum) && ($name = array_merge($name, ['remaining_sum'])) && ($val = array_merge($val, [$this->remaining_sum]));
  177. isset($this->lg) && ($name = array_merge($name, ['lg'])) && ($val = array_merge($val, [$this->lg]));
  178. isset($this->cash_max_day) && ($name = array_merge($name, ['cash_max_day'])) && ($val = array_merge($val, [$this->cash_max_day]));
  179. isset($this->cash_max_single_day) && ($name = array_merge($name, ['cash_max_single_day'])) && ($val = array_merge($val, [$this->cash_max_single_day]));
  180. isset($this->min_money) && ($name = array_merge($name, ['min_money'])) && ($val = array_merge($val, [$this->min_money]));
  181. isset($this->auto_money) && ($name = array_merge($name, ['auto_money'])) && ($val = array_merge($val, [$this->auto_money]));
  182. isset($this->old_range_name) && ($name = array_merge($name, ['old_range_name'])) && ($val = array_merge($val, [$this->old_range_name]));
  183. isset($this->direct_range_name) && ($name = array_merge($name, ['direct_range_name'])) && ($val = array_merge($val, [$this->direct_range_name]));
  184. isset($this->old_add_holder_name) && ($name = array_merge($name, ['old_add_holder_name'])) && ($val = array_merge($val, [$this->old_add_holder_name]));
  185. isset($this->dividends_condition) && ($name = array_merge($name, ['dividends_condition'])) && ($val = array_merge($val, [$this->dividends_condition]));
  186. isset($this->cycle) && ($name = array_merge($name, ['cycle'])) && ($val = array_merge($val, [$this->cycle]));
  187. isset($this->shareHolderProfitSwitch) && ($name = array_merge($name, ['shareHolderProfitSwitch'])) && ($val = array_merge($val, [$this->shareHolderProfitSwitch]));
  188. isset($this->shareHolderHighProfit) && ($name = array_merge($name, ['shareHolderHighProfit'])) && ($val = array_merge($val, [$this->shareHolderHighProfit]));
  189. isset($this->shareHolderAliasName) && ($name = array_merge($name, ['shareHolderAliasName'])) && ($val = array_merge($val, [$this->shareHolderAliasName]));
  190. isset($this->shareHolderRepeatProfitSwitch) && ($name = array_merge($name, ['shareHolderRepeatProfitSwitch'])) && ($val = array_merge($val, [$this->shareHolderRepeatProfitSwitch]));
  191. isset($this->shareHolderJiandian) && ($name = array_merge($name, ['shareHolderJiandian'])) && ($val = array_merge($val, [$this->shareHolderJiandian]));
  192. isset($this->userLevel) && ($name = array_merge($name, ['userLevel'])) && ($val = array_merge($val, [$this->userLevel]));
  193. //滑落
  194. isset($this->shareHolderChangeOldParentSwitch) && ($name = array_merge($name, ['shareHolderChangeOldParentSwitch'])) && ($val = array_merge($val, [$this->shareHolderChangeOldParentSwitch]));
  195. isset($this->shareHolderChangeOldParentNumber) && ($name = array_merge($name, ['shareHolderChangeOldParentNumber'])) && ($val = array_merge($val, [$this->shareHolderChangeOldParentNumber]));
  196. isset($this->shareHolderChangeChildMinNumber) && ($name = array_merge($name, ['shareHolderChangeChildMinNumber'])) && ($val = array_merge($val, [$this->shareHolderChangeChildMinNumber]));
  197. isset($this->userSlippedOnceSwitch) && ($name = array_merge($name, ['userSlippedOnceSwitch'])) && ($val = array_merge($val, [$this->userSlippedOnceSwitch]));
  198. //提现
  199. isset($this->cash_price_type) && ($name = array_merge($name, ['cash_price_type'])) && ($val = array_merge($val, [$this->cash_price_type ?: '1']));
  200. isset($this->cash_price_amount) && ($name = array_merge($name, ['cash_price_amount'])) && ($val = array_merge($val, [$this->cash_price_amount ?? 100]));
  201. isset($this->cash_price_integral) && ($name = array_merge($name, ['cash_price_integral'])) && ($val = array_merge($val, [$this->cash_price_integral ?? 0]));
  202. isset($this->cash_price_balance) && ($name = array_merge($name, ['cash_price_balance'])) && ($val = array_merge($val, [$this->cash_price_balance ?? 0]));
  203. //是否开启高等级是否参与加权平均
  204. isset($this->high_level_join_average) && ($name = array_merge($name, ['high_level_join_average'])) && ($val = array_merge($val, [$this->high_level_join_average ?? 0]));
  205. // if (isset($this->cash_price_type)) {
  206. // $total_profit = 0;
  207. // $cash_price_type = explode(',', $this->cash_price_type);
  208. // if (in_array(CashExt::CASH_PRICE_TYPE_AMOUNT, $cash_price_type)) {
  209. // $total_profit = bcadd($total_profit, $this->cash_price_amount, 2);
  210. // }
  211. // if (in_array(CashExt::CASH_PRICE_TYPE_INTEGRAL, $cash_price_type)) {
  212. // $total_profit = bcadd($total_profit, $this->cash_price_integral, 2);
  213. // }
  214. // if (in_array(CashExt::CASH_PRICE_TYPE_BALANCE, $cash_price_type)) {
  215. // $total_profit = bcadd($total_profit, $this->cash_price_balance, 2);
  216. // }
  217. // if ($total_profit != 100) {
  218. // return [
  219. // 'code' => 1,
  220. // 'msg' => '佣金/积分/余额比例设置错误'
  221. // ];
  222. // }
  223. // }
  224. //滑落处理 start
  225. if (intval($this->shareHolderChangeOldParentSwitch)) {
  226. if (isset($this->shareHolderChangeOldParentNumber) || isset($this->shareHolderChangeChildMinNumber)) {
  227. if (isset($this->shareHolderChangeOldParentNumber) && isset($this->shareHolderChangeChildMinNumber)) {
  228. // if ($this->shareHolderChangeChildMinNumber >= $this->shareHolderChangeOldParentNumber) {
  229. // return [
  230. // 'code' => 1,
  231. // 'msg' => '保存失败,自推最低人数需要小于自动滑落人数'
  232. // ];
  233. // }
  234. $holder_level_list = ShareHolderLevel::find()->where([
  235. 'is_delete' => 0,
  236. 'status' => 1,
  237. 'store_id' => $this->store_id,
  238. ])->asArray()->all();
  239. // 找出符合条件的等级
  240. $current_level = null;
  241. foreach ($holder_level_list as $holder_level) {
  242. $condition = json_decode($holder_level['condition'], true);
  243. if ((bool)$condition['shareholder']['is_open'] &&
  244. (int)$condition['shareholder']['num'] > 0 &&
  245. (bool)$condition['shareholder']['independent_team']
  246. ) {
  247. $current_level = $holder_level;
  248. break;
  249. }
  250. }
  251. if ($current_level) {
  252. //设置滑落数量时需要判断是否大于 可助力出局人数
  253. $condition = json_decode($current_level['condition'], true);
  254. //设置滑落数量时需要判断是否大于 可助力出局人数
  255. if ($condition['shareholder']['num'] <= $this->shareHolderChangeChildMinNumber) {
  256. return [
  257. 'code' => 1,
  258. 'msg' => '保存失败,滑落自推最低人数需要小于出局人数'
  259. ];
  260. }
  261. }
  262. }
  263. }
  264. }
  265. //滑落处理 end
  266. //默认值处理
  267. $cycle = Option::get('cycle', $this->store_id, 'bonus_pool')['value'];
  268. if (is_null($cycle) && !isset($this->cycle)) {
  269. $name = array_merge($name, ['cycle']);
  270. $val = array_merge($val, [0]);
  271. }
  272. //默认值处理
  273. $is_open_share = Option::get('is_open_share', $this->store_id, 'bonus_pool')['value'];
  274. if (is_null($is_open_share) && !isset($this->is_open_share)) {
  275. $name = array_merge($name, ['is_open_share']);
  276. $val = array_merge($val, [0]);
  277. }
  278. //默认值处理
  279. $is_open_range = Option::get('is_open_range', $this->store_id, 'bonus_pool')['value'];
  280. if (is_null($is_open_range) && !isset($this->is_open_range)) {
  281. $name = array_merge($name, ['is_open_range']);
  282. $val = array_merge($val, [0]);
  283. }
  284. //默认值处理
  285. $is_open_area = Option::get('is_open_area', $this->store_id, 'bonus_pool')['value'];
  286. if (is_null($is_open_area) && !isset($this->is_open_area)) {
  287. $name = array_merge($name, ['is_open_area']);
  288. $val = array_merge($val, [0]);
  289. }
  290. //默认值处理
  291. $team_num = Option::get('team_num', $this->store_id, 'bonus_pool')['value'];
  292. if (is_null($team_num) && !isset($this->team_num)) {
  293. $name = array_merge($name, ['team_num']);
  294. $val = array_merge($val, [3]);
  295. }
  296. //默认值处理
  297. $shareHolderProfit = Option::get('shareHolderProfit', $this->store_id, 'bonus_pool')['value'];
  298. if (is_null($shareHolderProfit) && !isset($this->shareHolderProfit)) {
  299. $name = array_merge($name, ['shareHolderProfit']);
  300. $val = array_merge($val, [0]);
  301. }
  302. //默认值处理
  303. $dividends_condition = Option::get('dividends_condition', $this->store_id, 'bonus_pool')['value'];
  304. if (is_null($dividends_condition) && !isset($this->dividends_condition)) {
  305. $name = array_merge($name, ['dividends_condition']);
  306. $val = array_merge($val, [0]);
  307. }
  308. //默认值处理
  309. $shareHolderProfitSwitch = Option::get('shareHolderProfitSwitch', $this->store_id, 'bonus_pool')['value'];
  310. if (is_null($shareHolderProfitSwitch) && !isset($this->shareHolderProfitSwitch)) {
  311. $name = array_merge($name, ['shareHolderProfitSwitch']);
  312. $val = array_merge($val, [0]);
  313. }
  314. //默认值处理
  315. $shareHolderJiandian = Option::get('shareHolderJiandian', $this->store_id, 'bonus_pool')['value'];
  316. if (is_null($shareHolderJiandian) && !isset($this->shareHolderJiandian)) {
  317. $name = array_merge($name, ['shareHolderJiandian']);
  318. $val = array_merge($val, [0]);
  319. }
  320. $res = Option::set($name, $val, $this->store_id, 'bonus_pool');
  321. if ($res) {
  322. return [
  323. 'code' => 0,
  324. 'msg' => '保存成功'
  325. ];
  326. } else {
  327. return [
  328. 'code' => 1,
  329. 'msg' => '保存失败'
  330. ];
  331. }
  332. }
  333. public function fugouSave()
  334. {
  335. Option::set('fugou', \json_encode($this->fugou), $this->store_id, 'bonus_pool');
  336. return [
  337. 'code' => 0,
  338. 'msg' => '保存成功'
  339. ];
  340. }
  341. public function fugouInfo()
  342. {
  343. $shareHolderLevel = ShareHolderLevel::find()->where(['store_id' => $this->store_id, 'is_delete' => 0, 'status' => 1])->asArray()->all();
  344. $fugouSetting = FuGou::getSetting($this->store_id);
  345. foreach ($fugouSetting['fugou_goods'] as $k => $goods) {
  346. $g = \app\models\Goods::find()->where(['id' => $goods['id']])->select('id, name, cover_pic, price, goods_num')->one();
  347. $fugouSetting['fugou_goods'][$k] = [
  348. 'id' => $g->id,
  349. 'name' => $g->name,
  350. 'cover_pic' => $g->cover_pic,
  351. 'price' => $g->price,
  352. 'goods_num' => $g->goods_num,
  353. 'fugou_price' => $goods['fugou_price'],
  354. ];
  355. }
  356. return [
  357. 'code' => 0,
  358. 'data' => [
  359. 'fugou_setting' => $fugouSetting,
  360. 'shareHolderLevel' => $shareHolderLevel
  361. ]
  362. ];
  363. }
  364. public function search()
  365. {
  366. $shareHolderLevel = ShareHolderLevel::find()->where(['store_id' => $this->store_id, 'is_delete' => 0, 'status' => 1])->asArray()->all();
  367. $userLevel = Level::find()->where(['store_id' => $this->store_id, 'is_delete' => 0, 'status' => 1])->asArray()->all();
  368. $setting = [
  369. 'shareHolderTeamRewardPlatformBears' => Option::get('shareHolderTeamRewardPlatformBears', $this->store_id, 'bonus_pool', 1)['value'], //是否平台承担平级奖
  370. 'shareHolderRewardPointRate' => Option::get('shareHolderRewardPointRate', $this->store_id, 'bonus_pool', 0)['value'], //发放积分占比佣金百分比
  371. 'shareHolderFrostSendCond' => Option::get('shareHolderFrostSendCond', $this->store_id, 'bonus_pool', 0)['value'], //帮扶佣金解冻条件 0默认条件 1升级条件
  372. 'dividends_method' => (string)(Option::get('dividends_method', $this->store_id, 'bonus_pool', 0)['value']), //分红方式 0平均分红 1团队业绩加权分红
  373. 'cycle' => Option::get('cycle', $this->store_id, 'bonus_pool', 0)['value'],
  374. 'is_open_share' => Option::get('is_open_share', $this->store_id, 'bonus_pool', 0)['value'],
  375. 'is_open_range' => Option::get('is_open_range', $this->store_id, 'bonus_pool', 0)['value'],
  376. 'team_num' => Option::get('team_num', $this->store_id, 'bonus_pool', 0)['value'],
  377. 'qrcode' => Option::get('qrcode', $this->store_id, 'bonus_pool', '')['value'],
  378. 'range_name' => Option::get('range_name', $this->store_id, 'bonus_pool', '级差分红')['value'],
  379. 'holder_name' => Option::get('holder_name', $this->store_id, 'bonus_pool', '股东分红')['value'],
  380. 'area_name' => Option::get('area_name', $this->store_id, 'bonus_pool', '')['value'],
  381. 'old_range_name' => Option::get('old_range_name', $this->store_id, 'bonus_pool', '级差分红(原关系)')['value'],
  382. 'direct_range_name' => Option::get('direct_range_name', $this->store_id, 'bonus_pool', '直推团队收益')['value'],
  383. 'old_add_holder_name' => Option::get('old_add_holder_name', $this->store_id, 'bonus_pool', '直推团队收益(原关系)')['value'],
  384. 'is_open_area' => Option::get('is_open_area', $this->store_id, 'bonus_pool', 0)['value'],
  385. 'shareHolderProfit' => Option::get('shareHolderProfit', $this->store_id, 'bonus_pool', 0)['value'],
  386. 'shareHolderPriceMin' => Option::get('shareHolderPriceMin', $this->store_id, 'bonus_pool', 0)['value'],
  387. 'shareHolderPriceLevel' => Option::get('shareHolderPriceLevel', $this->store_id, 'bonus_pool', 0)['value'],
  388. 'shareHolderCashProfit' => Option::get('shareHolderCashProfit', $this->store_id, 'bonus_pool', 0)['value'],
  389. 'shareHolderLevel' => Option::get('shareHolderLevel', $this->store_id, 'bonus_pool', 0)['value'],
  390. 'shareHolderNumber' => Option::get('shareHolderNumber', $this->store_id, 'bonus_pool', '0,0')['value'],
  391. 'shareHolderHasCheck' => Option::get('shareHolderHasCheck', $this->store_id, 'bonus_pool', 0)['value'],
  392. 'pay_wechat' => Option::get('pay_wechat', $this->store_id, 'bonus_pool', 0)['value'],
  393. 'pay_alipay' => Option::get('pay_alipay', $this->store_id, 'bonus_pool', 0)['value'],
  394. 'bank' => Option::get('bank', $this->store_id, 'bonus_pool', 0)['value'],
  395. 'remaining_sum' => Option::get('remaining_sum', $this->store_id, 'bonus_pool', 0)['value'],
  396. 'lg' => Option::get('lg', $this->store_id, 'bonus_pool', 0)['value'],
  397. 'cash_max_day' => Option::get('cash_max_day', $this->store_id, 'bonus_pool', 0)['value'],
  398. 'cash_max_single_day' => Option::get('cash_max_single_day', $this->store_id, 'bonus_pool', 0)['value'],
  399. 'min_money' => Option::get('min_money', $this->store_id, 'bonus_pool', 0)['value'],
  400. 'auto_money' => Option::get('auto_money', $this->store_id, 'bonus_pool', 0)['value'],
  401. 'dividends_condition' => Option::get('dividends_condition', $this->store_id, 'bonus_pool', 0)['value'],
  402. 'shareHolderProfitSwitch' => (int)Option::get('shareHolderProfitSwitch', $this->store_id, 'bonus_pool', 0)['value'],
  403. 'shareHolderHighProfit' => Option::get('shareHolderHighProfit', $this->store_id, 'bonus_pool', 0)['value'],
  404. 'shareHolderAliasName' => Option::get('shareHolderAliasName', $this->store_id, 'bonus_pool', '股东')['value'],
  405. 'shareHolderRepeatProfitSwitch' => (int)Option::get('shareHolderRepeatProfitSwitch', $this->store_id, 'bonus_pool', 0)['value'],//是否开启小推大复购限制
  406. 'shareHolderJiandian' => (int)Option::get('shareHolderJiandian', $this->store_id, 'bonus_pool', 0)['value'],
  407. 'shareHolderChangeOldParentSwitch' => (int)Option::get('shareHolderChangeOldParentSwitch', $this->store_id, 'bonus_pool', 0)['value'],
  408. 'shareHolderChangeOldParentNumber' => (int)Option::get('shareHolderChangeOldParentNumber', $this->store_id, 'bonus_pool', 0)['value'],
  409. 'shareHolderChangeChildMinNumber' => (int)Option::get('shareHolderChangeChildMinNumber', $this->store_id, 'bonus_pool', 0)['value'],
  410. 'userSlippedOnceSwitch' => (int)Option::get('userSlippedOnceSwitch', $this->store_id, 'bonus_pool', 0)['value'],
  411. 'userLevel' => Option::get('userLevel', $this->store_id, 'bonus_pool', 0)['value'],
  412. 'cash_price_type' => Option::get('cash_price_type', $this->store_id, 'bonus_pool', '1')['value'],
  413. 'cash_price_amount' => Option::get('cash_price_amount', $this->store_id, 'bonus_pool', 100)['value'],
  414. 'cash_price_integral' => Option::get('cash_price_integral', $this->store_id, 'bonus_pool', 0)['value'],
  415. 'cash_price_balance' => Option::get('cash_price_balance', $this->store_id, 'bonus_pool', 0)['value'],
  416. //高等级是否参与加权平均
  417. 'high_level_join_average' => intval(Option::get('high_level_join_average', $this->store_id, 'bonus_pool', 0)['value']),
  418. ];
  419. $setting['shareHolderNumber'] = explode(',', $setting['shareHolderNumber']);
  420. return [
  421. 'code' => 0,
  422. 'data' => [
  423. 'setting' => $setting,
  424. 'shareHolderLevel' => $shareHolderLevel,
  425. 'userLevel' => $userLevel
  426. ]
  427. ];
  428. }
  429. }