Browse Source

会员升级

Kirin 7 months ago
parent
commit
a32bf3763b
1 changed files with 9 additions and 9 deletions
  1. 9 9
      app/services/user/AwardIntegralServices.php

+ 9 - 9
app/services/user/AwardIntegralServices.php

@@ -165,7 +165,7 @@ class AwardIntegralServices extends BaseServices
             'uid' => $uid,
             'num' => $total,
             'send_day' => $send_day,
-            'day_send' => bcdiv($total, $send_day, 2),
+            'day_send' => bcdiv((string)$total, (string)$send_day, 2),
             'sum_price' => $total,
             'order_id' => $order_id,
             'link_id' => $link_id,
@@ -229,7 +229,7 @@ class AwardIntegralServices extends BaseServices
         $inc_integral = $total;
         $origin = $this->get($id);
         return $this->dao->update($id, [
-            'up_speed' => bcadd($origin['up_speed'], $inc_integral, 2),
+            'up_speed' => bcadd((string)$origin['up_speed'], (string)$inc_integral, 2),
         ]);
     }
 
@@ -286,8 +286,8 @@ class AwardIntegralServices extends BaseServices
             $num = $origin['extract_num'];
         }
         if ($num <= 0) return true;
-        $update['extract_num'] = bcsub($origin['extract_num'], $num, 2);
-        $update['extracted_num'] = bcadd($origin['extracted_num'], $num, 2);
+        $update['extract_num'] = bcsub($origin['extract_num'], (string)$num, 2);
+        $update['extracted_num'] = bcadd($origin['extracted_num'], (string)$num, 2);
         $this->update($id, $update);
         $res = true;
         /** @var UserBrokerageServices $brokerageService */
@@ -305,16 +305,16 @@ class AwardIntegralServices extends BaseServices
         $mark = '用户参考分' . $system ? '出局' : '提取' . $num;
         $to_integral = bcdiv(bcmul((string)$num, (string)$to_integral), '100', 2);
         if ($to_integral > 0) {
-            $balance = bcadd($user['integral'], $to_integral, 2);
+            $balance = bcadd($user['integral'], (string)$to_integral, 2);
             $res = $res && $billService->income('extract_integral_shop', $uid, [
                     'mark' => $mark,
                     'number' => floatval($to_integral),
                 ], $balance, $id);
             // 添加用户佣金
-            $res = $res && $userService->bcInc($uid, 'integral', $to_integral, 'uid');
+            $res = $res && $userService->bcInc($uid, 'integral', (string)$to_integral, 'uid');
         }
         if ($to_integral < $num) {
-            $left = bcsub((string)$num, $to_integral, 2);
+            $left = bcsub((string)$num, (string)$to_integral, 2);
             if ($reorder_set > $origin['reorder_count']) {
                 $to_now_money = sys_config('re_now_money');
                 $to_now_money = bcdiv(bcmul($left, (string)$to_now_money), '100', 2);
@@ -328,7 +328,7 @@ class AwardIntegralServices extends BaseServices
                     $res = $res && $userService->bcInc($uid, 'now_money', $to_now_money, 'uid');
                 }
                 $to_energy = sys_config('re_energy');
-                $to_energy = bcdiv(bcmul($left, (string)$to_energy), '100', 2);
+                $to_energy = bcdiv(bcmul((string)$left, (string)$to_energy), '100', 2);
                 if ($to_energy > 0) {
                     $balance = bcadd($user['energy'], $to_energy, 2);
                     $res = $res && $billService->income('extract_integral_static', $uid, [
@@ -340,7 +340,7 @@ class AwardIntegralServices extends BaseServices
                 }
                 $to_brokerage = 100 - $to_now_money - $to_energy;
                 if ($to_brokerage < 0) $to_brokerage = 0;
-                $to_brokerage = bcdiv(bcmul($left, (string)$to_brokerage), '100', 2);
+                $to_brokerage = bcdiv(bcmul((string)$left, (string)$to_brokerage), '100', 2);
                 if ($to_brokerage > 0) {
                     $balance = bcadd($user['brokerage_price'], $to_brokerage, 2);
                     $res = $res && $brokerageService->income('extract_integral_static', $uid, [