Ken пре 2 дана
родитељ
комит
1f50615973
2 измењених фајлова са 10 додато и 12 уклоњено
  1. 7 2
      app/Models/Rebate.php
  2. 3 10
      app/Services/BetService.php

+ 7 - 2
app/Models/Rebate.php

@@ -1,7 +1,9 @@
 <?php
 
 namespace App\Models;
+
 use Carbon\Carbon;
+
 class Rebate extends BaseModel
 {
 
@@ -15,8 +17,6 @@ class Rebate extends BaseModel
     const STATUS_FAN_YONG = 1; //已返佣
 
 
-
-
     static function updateProfit($data)
     {
         $data['date'] = Carbon::now('America/New_York')->format('Y-m-d');
@@ -28,6 +28,11 @@ class Rebate extends BaseModel
 
     static function addOrUpdate($data)
     {
+        $data['date'] = Carbon::now('America/New_York')->format('Y-m-d');
+        $data['rebate_ratio'] = Config::where('field', 'rebate')->first()->val;
+        $data['huishui_restriction'] = Config::where('field', 'huishui_restriction')->first()->val;
+        $data['huishui_percentage'] = Config::where('field', 'huishui_percentage')->first()->val;
+
         $rebate = static::where('date', $data['date'])
             ->where('member_id', $data['member_id'])->first();
         if ($rebate) {

+ 3 - 10
app/Services/BetService.php

@@ -241,6 +241,7 @@ class BetService extends BaseService
     private static function singleNote($memberId, $keywords, $amount, &$issueNo, &$text, &$errText): bool
     {
         $errText .= "【{$keywords}{$amount}】\n";
+        //客服号
         $serviceAccount = Config::where('field', 'service_customer')->first()->val;
         $gameplayRuleInfo = GameplayRuleService::getGameplayRules($keywords);
         if ($gameplayRuleInfo == null) {
@@ -330,21 +331,14 @@ class BetService extends BaseService
         BalanceLogService::addLog($memberId, -$amount, $balance, ($balance - $amount), '投注', $bet_id, '');
 
 
-        $now = Carbon::now('America/New_York')->format('Y-m-d');
-        $rebate = Config::where('field', 'rebate')->first()->val;
-        $huishui_restriction = Config::where('field', 'huishui_restriction')->first()->val;
-        $huishui_percentage = Config::where('field', 'huishui_percentage')->first()->val;
+
+        //记录反水
         $rebate = Rebate::addOrUpdate([
-            'date' => $now,
             'member_id' => $memberId,
             'betting_amount' => $amount,
-            'rebate_ratio' => $rebate,
             'first_name' => $userInfo->first_name,
             'username' => $userInfo->username,
-            'huishui_restriction' => $huishui_restriction,
-            'huishui_percentage' => $huishui_percentage,
         ]);
-
         if (!RebateService::BibiReturn($rebate, $amount)) {
             $errText .= lang("比比返失败");
             return false;
@@ -369,7 +363,6 @@ class BetService extends BaseService
         $inlineButton = self::getOperateButton();
 
         // 群通知
-        // self::bettingGroupNotice($groupText, $inlineButton);   // 群通知
         self::asyncBettingGroupNotice($groupText, $inlineButton);   // 异步群通知
 
         return true;