seven 3 일 전
부모
커밋
28fb160e11
1개의 변경된 파일15개의 추가작업 그리고 0개의 파일을 삭제
  1. 15 0
      app/Services/BetService.php

+ 15 - 0
app/Services/BetService.php

@@ -231,6 +231,21 @@ class BetService extends BaseService
 
         BalanceLogService::addLog($memberId,-$amount,$balance,($balance-$amount),'投注',$newBet->id,'');
 
+        // 返利
+        $rebate = Config::where('field', 'rebate')->first()->val;
+        if($rebate > 0){
+            $rebateAmount = bcmul($amount, bcdiv($rebate, 100, 2), 2); // 返利金额
+            if($rebateAmount > 0){
+                WalletService::updateBalance($memberId,$rebateAmount);
+
+                $walletInfo = WalletService::findOne(['member_id' => $memberId]);
+                $balance = $walletInfo['available_balance']; 
+
+                BalanceLogService::addLog($memberId,$rebateAmount,$balance,($balance+$rebateAmount),'反水',$newBet->id,'');
+            }
+
+        }
+
         $text = "下注期数:{$issueInfo->issue_no}\n";
         $text .= "下注内容\n";
         $text .= "--------\n";