瀏覽代碼

会员升级

Kirin 1 年之前
父節點
當前提交
810873f6e6
共有 1 個文件被更改,包括 30 次插入3 次删除
  1. 30 3
      app/jobs/integral/IntegralJob.php

+ 30 - 3
app/jobs/integral/IntegralJob.php

@@ -70,8 +70,10 @@ class IntegralJob extends BaseJobs
                         $give_action_integral = bcdiv(bcmul($total_price, $award_ratio), 100, 2);
                         if ($give_action_integral > 0) {
                             $first = $awardIntegralService->getFirstStaticIntegral($spread['uid']);
-                            $mark = ',推荐用户' . $user['nickname'] . "({$user['uid']})" . '购买商品,获得加速积分';
-                            $awardIntegralService->incUpdateIntegral($first['id'], $integral_price, $give_action_integral, $mark);
+                            if ($first) {
+                                $mark = ',推荐用户' . $user['nickname'] . "({$user['uid']})" . '购买商品,获得加速积分';
+                                $awardIntegralService->incUpdateIntegral($first['id'], $integral_price, $give_action_integral, $mark);
+                            }
                         }
                     }
                 }
@@ -189,8 +191,20 @@ class IntegralJob extends BaseJobs
                 $sum = $info['extract_sum'];
             }
             $real_out = bcdiv(bcmul($sum, sys_config('extract_ratio', 0)), 100, 2);
+//            $left = bcsub($info['num'], bcdiv(bcmul($info['num'], sys_config('extract_ratio', 0)), 100, 2), 5);
+//            $to_top = bcdiv(bcmul($left, sys_config('extract_speed_ratio', 0)), 100, 5);
+//            $num = sys_config('extract_speed_num', 0);
+//            if ($num > 0) {
+//                $to_top = bcdiv($to_top, $num, 5);
+//            } else {
+//                $to_top = 0;
+//            }
+//            $to_spread = 0;
+//            if ($info['type'] == 0) {
+//                $to_spread = bcdiv(bcmul($info['num'], sys_config('extract_spread_ratio', 0)), 100, 2);
+//            }
+            $user = $userService->getUserInfo($info['uid']);
             if ($real_out > 0) {
-                $user = $userService->getUserInfo($info['uid']);
                 $mark = '用户积分出局,出局时价格' . $price;
                 $res = $res && $awardIntegralService->addLake(-$real_out, $info['id'], $mark);
 
@@ -218,6 +232,19 @@ class IntegralJob extends BaseJobs
                 $res = $res && $userService->bcInc($info['uid'], 'energy', $to_energy, 'uid');
                 $res = $res && $awardIntegralService->update($info['id'], ['handle' => 0, 'extract_sum_real' => $sum, 'status' => 1, 'extract_time' => time()]);
             }
+//            if ($to_top > 0) {
+//
+//            }
+//            if ($to_spread > 0) {
+//                $spread = $userService->getUserInfo($user['spread_uid']);
+//                if ($spread) {
+//                    $first = $awardIntegralService->getFirstStaticIntegral($spread['uid']);
+//                    if ($first) {
+//                        $mark = ',推荐用户' . $user['nickname'] . "({$user['uid']})" . '消费分出局,获得加速积分';
+//                        $awardIntegralService->incUpdateIntegral($first['id'], $integral_price, $give_action_integral, $mark);
+//                    }
+//                }
+//            }
         }
         if (count($infos) > 0) return $res && $this->autoExtract($awardIntegralService->getPrice());
         return $res;