|
@@ -64,11 +64,17 @@ class IntegralJob extends BaseJobs
|
|
|
//推荐奖
|
|
|
$rate = sys_config('action_integral_rate', 3);
|
|
|
$spread = $userService->getUserInfo($user['spread_uid']);
|
|
|
- if ($spread && $spread['is_promoter'] && $order['pay_type'] != 'yue') {
|
|
|
+ if ($spread && $spread['is_promoter']) {
|
|
|
if ($awardIntegralService->getPaySum($spread['uid']) >= $award_order_limit) {
|
|
|
$award_ratio = sys_config('recommend_integral', 0);
|
|
|
+ if ($order['pay_type'] == 'yue') {
|
|
|
+ $award_ratio = sys_config('recommend_integral_yue', 0);
|
|
|
+ }
|
|
|
if (($integral_info['link_id'] ?? 0) > 0) {
|
|
|
$award_ratio = sys_config('reorder_recommend_integral', 0);
|
|
|
+ if ($order['pay_type'] == 'yue') {
|
|
|
+ $award_ratio = sys_config('reorder_recommend_integral_yue', 0);
|
|
|
+ }
|
|
|
}
|
|
|
$give_action_integral = bcdiv(bcmul($total_price, $award_ratio), 100, 2);
|
|
|
if ($give_action_integral > 0) {
|
|
@@ -93,30 +99,28 @@ class IntegralJob extends BaseJobs
|
|
|
$levelServices->detection((int)$user['uid']);
|
|
|
$pass = [$user['uid']];
|
|
|
$send = 0;
|
|
|
- if ($spread && $order['pay_type'] != 'yue') {
|
|
|
- while ($spread && !in_array($spread['uid'], $pass)) {
|
|
|
- //先发奖,再结算等级
|
|
|
- $level = $levelServices->getUserLevel($spread['uid']);
|
|
|
- $ratio = $level['levelInfo']['group_award'] ?? 0;
|
|
|
- $give_action_integral = bcdiv(bcmul($total_price, $ratio), 100, 2);
|
|
|
- if ($give_action_integral > $send && $spread['is_promoter']) {
|
|
|
- $real_send = bcsub($give_action_integral, $send, 2);
|
|
|
- if ($awardIntegralService->getPaySum2($spread['uid']) >= $award_order_limit_2 || $spread['award_switch']) {
|
|
|
- $extract_sum = bcmul($real_send, $rate, 2);
|
|
|
- $mark = '团队用户' . $user['nickname'] . "({$user['uid']})" . '购买商品,获得团队级差积分';
|
|
|
- $this->sendAward($extract_sum, $spread['uid'], $mark, $order['id']);
|
|
|
- $oldAwardIntegralService->incIntegral($spread['uid'], 0, $give_action_integral, $total_price, 1, $extract_sum, $order['id'], $mark);
|
|
|
- }
|
|
|
- $send = $give_action_integral;
|
|
|
+ while ($spread && !in_array($spread['uid'], $pass)) {
|
|
|
+ //先发奖,再结算等级
|
|
|
+ $level = $levelServices->getUserLevel($spread['uid']);
|
|
|
+ $ratio = $level['levelInfo']['group_award'] ?? 0;
|
|
|
+ $give_action_integral = bcdiv(bcmul($total_price, $ratio), 100, 2);
|
|
|
+ if ($give_action_integral > $send && $spread['is_promoter']) {
|
|
|
+ $real_send = bcsub($give_action_integral, $send, 2);
|
|
|
+ if ($awardIntegralService->getPaySum2($spread['uid']) >= $award_order_limit_2 || $spread['award_switch']) {
|
|
|
+ $extract_sum = bcmul($real_send, $rate, 2);
|
|
|
+ $mark = '团队用户' . $user['nickname'] . "({$user['uid']})" . '购买商品,获得团队级差积分';
|
|
|
+ $this->sendAward($extract_sum, $spread['uid'], $mark, $order['id']);
|
|
|
+ $oldAwardIntegralService->incIntegral($spread['uid'], 0, $give_action_integral, $total_price, 1, $extract_sum, $order['id'], $mark);
|
|
|
}
|
|
|
- try {
|
|
|
- $levelServices->detection((int)$spread['uid']);
|
|
|
- } catch (ValidateException $e) {
|
|
|
+ $send = $give_action_integral;
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ $levelServices->detection((int)$spread['uid']);
|
|
|
+ } catch (ValidateException $e) {
|
|
|
|
|
|
- }
|
|
|
- $pass[] = $spread['uid'];
|
|
|
- $spread = $userService->getUserInfo($spread['spread_uid']);
|
|
|
}
|
|
|
+ $pass[] = $spread['uid'];
|
|
|
+ $spread = $userService->getUserInfo($spread['spread_uid']);
|
|
|
}
|
|
|
// $this->autoExtract($awardIntegralService->getPrice());
|
|
|
Log::debug(date('Y-m-d H:i:s') . '结束处理' . $order['id'] . '积分');
|