|
@@ -36,6 +36,7 @@ class IntegralJob extends BaseJobs
|
|
|
$user = $userService->getUserInfo($order['uid']);
|
|
|
// $integral_price = $awardIntegralService->getPrice($order['id']);
|
|
|
$total_price = $order['award_price'];
|
|
|
+
|
|
|
// $award_price = bcsub($total_price, $order['cost'], 2);
|
|
|
return $awardIntegralService->transaction(function () use ($levelServices, $awardIntegralService, $userService, $user, $total_price, $order) {
|
|
|
try {
|
|
@@ -63,7 +64,7 @@ class IntegralJob extends BaseJobs
|
|
|
//推荐奖
|
|
|
$rate = sys_config('action_integral_rate', 3);
|
|
|
$spread = $userService->getUserInfo($user['spread_uid']);
|
|
|
- if ($spread && $spread['is_promoter']) {
|
|
|
+ if ($spread && $spread['is_promoter'] && $order['pay_type'] != 'yue') {
|
|
|
if ($awardIntegralService->getPaySum($spread['uid']) >= $award_order_limit) {
|
|
|
$award_ratio = sys_config('recommend_integral', 0);
|
|
|
if (($integral_info['link_id'] ?? 0) > 0) {
|
|
@@ -92,28 +93,30 @@ class IntegralJob extends BaseJobs
|
|
|
$levelServices->detection((int)$user['uid']);
|
|
|
$pass = [$user['uid']];
|
|
|
$send = 0;
|
|
|
- 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);
|
|
|
+ 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;
|
|
|
}
|
|
|
- $send = $give_action_integral;
|
|
|
- }
|
|
|
- try {
|
|
|
- $levelServices->detection((int)$spread['uid']);
|
|
|
- } catch (ValidateException $e) {
|
|
|
+ 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'] . '积分');
|