Răsfoiți Sursa

渠道没钱自动关闭权重 update

Tree 1 zi în urmă
părinte
comite
03b02ef60b

+ 1 - 0
app/Http/logic/api/AiNewPayCashierLogic.php

@@ -85,6 +85,7 @@ class AiNewPayCashierLogic implements CashierInterFace
         if (isset($data['code']) && $data['code'] == 0) {
             return $data;
         } else {
+            WithdrawalPayoutMonitor::handleFailedCallback(self::AGENT, $data, $OrderId);
             if ($query->State == 5) {
                 $msg = 'Liquidation failure';
                 $WithDraw = $query->WithDraw + $query->ServiceFee;

+ 1 - 0
app/Http/logic/api/SafePayCashierLogic.php

@@ -102,6 +102,7 @@ class SafePayCashierLogic implements CashierInterFace
         }
 
         // 同步失败处理:回复玩家金币,标记订单失败
+        WithdrawalPayoutMonitor::handleFailedCallback(self::AGENT, $data, $OrderId);
         if ($query->State == 5) {
             $msg = 'Liquidation failure';
             $WithDraw = $query->WithDraw + $query->ServiceFee;

+ 1 - 0
app/Http/logic/api/SfPayCashierLogic.php

@@ -106,6 +106,7 @@ class SfPayCashierLogic implements CashierInterFace
         }
 
         // 同步失败处理:回复玩家金币,标记订单失败
+        WithdrawalPayoutMonitor::handleFailedCallback(self::AGENT, $data, $OrderId);
         if ($query->State == 5) {
             $msg = 'Liquidation failure';
             $WithDraw = $query->WithDraw + $query->ServiceFee;

+ 1 - 0
app/Http/logic/api/WDPayCashierLogic.php

@@ -103,6 +103,7 @@ class WDPayCashierLogic implements CashierInterFace
             // 提现失败处理
             Util::WriteLog('WDPay_payout_error', "提现失败: {$OrderId} | " . json_encode($data));
             
+            WithdrawalPayoutMonitor::handleFailedCallback(self::AGENT, $data, $OrderId);
             if ($query->State == 5) {
                 // 同步失败,发送邮件给玩家,退还金币
                 $msg = $data['message'] ?? 'Transfer failed';

+ 4 - 6
app/Services/WithdrawalPayoutMonitor.php

@@ -17,16 +17,14 @@ class WithdrawalPayoutMonitor
         }
 
         $changed = WithdrawalAgentRatioConfig::disableAgent($agent);
-        if ($changed) {
-            self::sendInsufficientBalanceNotice($agent, $orderId, $message);
-        }
+        self::sendInsufficientBalanceNotice($agent, $orderId, $message, $changed);
 
         return $changed;
     }
 
     private static function isInsufficientBalance($message)
     {
-        return preg_match('/insufficient\s*(balance|funds)|balance\s*(is\s*)?(not\s*)?enough|not\s*enough\s*balance|\x{4F59}\x{989D}\x{4E0D}\x{8DB3}/iu', $message) === 1;
+        return preg_match('/insufficien\w*|insufficent|not\s*sufficient|balance\s*(is\s*)?(not\s*)?enough|not\s*enough\s*balance|\x{4F59}\x{989D}\x{4E0D}\x{8DB3}/iu', $message) === 1;
     }
 
     private static function callbackText($callback)
@@ -38,7 +36,7 @@ class WithdrawalPayoutMonitor
         return strval($callback);
     }
 
-    private static function sendInsufficientBalanceNotice($agent, $orderId, $message)
+    private static function sendInsufficientBalanceNotice($agent, $orderId, $message, $changed)
     {
         $agentName = DB::table('agent.dbo.admin_configs')
             ->where('type', 'cash')
@@ -48,7 +46,7 @@ class WithdrawalPayoutMonitor
         $content = "Insufficient balance\n"
             . "Payout channel: " . ($agentName ?: $agent) . "({$agent})\n"
             . "Order ID: " . ($orderId ?: '-') . "\n"
-            . "Auto payout ratio for this channel has been set to 0\n"
+            . "Auto payout ratio status: " . ($changed ? 'set to 0' : 'already 0') . "\n"
             . "Callback: " . mb_substr($message, 0, 800);
 
         try {