seven 2 месяцев назад
Родитель
Сommit
ab2276943d
1 измененных файлов с 8 добавлено и 3 удалено
  1. 8 3
      app/Services/BetService.php

+ 8 - 3
app/Services/BetService.php

@@ -585,12 +585,16 @@ class BetService extends BaseService
 
             if (in_array($v['keywords'], $awards)) {
                 $profit = $v['amount'] * $v['odds'];
+                $amount = (float)$v['amount'];
+                $odds = (float)$v['odds'];
+                $profit = bcmul($amount, $odds, 2); // 保留两位小数
                 if ($profit > 880000) {
                     $profit = 880000; // 单注最高奖金880000
                 }
                 $item['profit'] = $profit;
 
-                $yl = $profit - $v['amount'];
+                // $yl = $profit - $v['amount'];
+                $yl = bcsub($profit, $amount, 2); // 盈利
                 if ($k + 1 <= $realNoticeNum) {
 
                     $text .= "{$v['keywords']} 【" . $lastStr . "】{$v['amount']} {$profit} {$yl}\n";
@@ -644,13 +648,14 @@ class BetService extends BaseService
             if (in_array($v['keywords'], $awards)) {
                 $amount = (float)$v['amount'];
                 $odds = (float)$v['odds'];
-                $profit = $amount * $odds;
+                $profit = bcmul($amount, $odds, 2); // 保留两位小数
                 if ($profit > 880000) {
                     $profit = 880000; // 单注最高奖金880000
                 }
                 $item['profit'] = $profit;
 
-                $yl = $profit - $amount;
+                // $yl = $profit - $amount;
+                $yl = bcsub($profit, $amount, 2); // 盈利
                 if ($k + 1 <= $rand_num) {
                     $text .= "{$v['keywords']} 【" . $lastStr . "】 {$v['amount']} {$profit} {$yl}\n";
                 }