Kirin 5 днів тому
батько
коміт
59efc5c877

+ 26 - 22
app/jobs/integral/IntegralJob.php

@@ -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'] . '积分');

+ 20 - 6
app/model/user/AwardIntegral.php

@@ -110,13 +110,20 @@ class AwardIntegral extends BaseModel
         $award_order_limit = sys_config('award_order_limit');
         if ($award_order_limit_type == 1) $award_order_limit = 0.01;
         if ($value == 1) {
-            $query->where('status', 0)->where('sent_num<num')->where('order_price', '>=', $award_order_limit)->where('add_time', '>=', strtotime('2024-11-18'));
+            $query->where('status', 0)->where('sent_num<num')
+                ->where('order_price', '>=', $award_order_limit)
+                ->where('add_time', '>=', strtotime('2024-11-18'))
+                ->where('pay_type', '<>', 'yue');
         } else if ($value == 2) {
             $query->where(function ($query) {
                 $query->where('status', 1)->whereOr('sent_num>=num');
-            })->where('order_price', '>=', $award_order_limit);
+            })->where('order_price', '>=', $award_order_limit)
+                ->where('add_time', '>=', strtotime('2024-11-18'))
+                ->where('pay_type', '<>', 'yue');
         } else {
-            $query->where('order_price', '<', $award_order_limit);
+            $query->where('order_price', '<', $award_order_limit)
+                ->whereOr('add_time', '<', strtotime('2024-11-18'))
+                ->whereOr('pay_type', 'yue');
         }
     }
 
@@ -131,13 +138,20 @@ class AwardIntegral extends BaseModel
         $award_order_limit = sys_config('award_order_limit_2');
         if ($award_order_limit_type == 1) $award_order_limit = 0.01;
         if ($value == 1) {
-            $query->where('status', 0)->where('sent_num<num')->where('order_price', '>=', $award_order_limit)->where('add_time', '>=', strtotime('2024-11-18'));
+            $query->where('status', 0)->where('sent_num<num')
+                ->where('order_price', '>=', $award_order_limit)
+                ->where('add_time', '>=', strtotime('2024-11-18'))
+                ->where('pay_type', '<>', 'yue');
         } else if ($value == 2) {
             $query->where(function ($query) {
                 $query->where('status', 1)->whereOr('sent_num>=num');
-            })->where('order_price', '>=', $award_order_limit);
+            })->where('order_price', '>=', $award_order_limit)
+                ->where('add_time', '>=', strtotime('2024-11-18'))
+                ->where('pay_type', '<>', 'yue');
         } else {
-            $query->where('order_price', '<', $award_order_limit);
+            $query->where('order_price', '<', $award_order_limit)
+                ->whereOr('add_time', '<', strtotime('2024-11-18'))
+                ->whereOr('pay_type', 'yue');
         }
     }
 

+ 3 - 1
app/services/system/config/SystemConfigServices.php

@@ -1485,7 +1485,7 @@ WSS;
             'district_award', 'city_award', 'province_award', 'area_award_time', 'reorder_recommend_integral', 'starts_return_time', 'exchange_fee', 'user_exchange_min_energy', 'stock_price',
             'default_send_day', 'int_send_day', 'reorder_int_send_day', 'reorder_times', 'shop_integral_ratio', 're_now_money', 're_energy', 'system_achievement_check',
             'fail_inc_send_day', 'shop_integral_trade_commission','shop_integral_trade_commission_shop', 'shop_integral_trade_switch', 'award_order_limit_type', 'award_order_limit',
-            'award_order_limit_type_2', 'award_order_limit_2',
+            'award_order_limit_type_2', 'award_order_limit_2','recommend_integral_yue','reorder_recommend_integral_yue'
         ]);
 
         $build->rule([
@@ -1521,7 +1521,9 @@ WSS;
 //                Build::inputNum('static_integral_ratio', $data['static_integral_ratio']['info'], $data['static_integral_ratio']['value'])->min(0)->info($data['static_integral_ratio']['desc']),
 //                Build::inputNum('lake_ratio', $data['lake_ratio']['info'], $data['lake_ratio']['value'])->min(0)->info($data['lake_ratio']['desc']),
                 Build::inputNum('recommend_integral', $data['recommend_integral']['info'], $data['recommend_integral']['value'])->min(0)->info($data['recommend_integral']['desc']),
+                Build::inputNum('recommend_integral_yue', $data['recommend_integral_yue']['info'], $data['recommend_integral_yue']['value'])->min(0)->info($data['recommend_integral_yue']['desc']),
                 Build::inputNum('reorder_recommend_integral', $data['reorder_recommend_integral']['info'], $data['reorder_recommend_integral']['value'])->min(0)->info($data['reorder_recommend_integral']['desc']),
+                Build::inputNum('reorder_recommend_integral_yue', $data['reorder_recommend_integral_yue']['info'], $data['reorder_recommend_integral_yue']['value'])->min(0)->info($data['reorder_recommend_integral_yue']['desc']),
                 Build::inputNum('recommend_speed_integral', $data['recommend_speed_integral']['info'], $data['recommend_speed_integral']['value'])->min(0)->info($data['recommend_speed_integral']['desc']),
                 Build::inputNum('static_integral_rate', $data['static_integral_rate']['info'], $data['static_integral_rate']['value'])->min(0)->info($data['static_integral_rate']['desc']),
 //                Build::inputNum('action_integral_rate', $data['action_integral_rate']['info'], $data['action_integral_rate']['value'])->min(0)->info($data['action_integral_rate']['desc']),