优化ai小班长

This commit is contained in:
2026-04-12 21:42:55 +08:00
parent a4cc85b558
commit f8d5a3b250
+12 -14
View File
@@ -316,19 +316,17 @@ class AiBaccaratBetJob implements ShouldQueue
private function manageFinances(User $user, ChatStateService $chatState): void private function manageFinances(User $user, ChatStateService $chatState): void
{ {
// 1. 检查是否有“买单”活动补偿可领取 (jjb 较低时优先领取) // 1. 检查是否有“买单”活动补偿可领取 (jjb 较低时优先领取)
if ($user->jjb < 20000) { $lossCoverService = app(\App\Services\BaccaratLossCoverService::class);
$lossCoverService = app(\App\Services\BaccaratLossCoverService::class); $pendingEvents = \App\Models\BaccaratLossCoverEvent::where('status', 'claimable')->get();
$pendingEvents = \App\Models\BaccaratLossCoverEvent::where('status', 'claimable')->get(); foreach ($pendingEvents as $event) {
foreach ($pendingEvents as $event) { $record = \App\Models\BaccaratLossCoverRecord::where('event_id', $event->id)
$record = \App\Models\BaccaratLossCoverRecord::where('event_id', $event->id) ->where('user_id', $user->id)
->where('user_id', $user->id) ->where('claim_status', 'pending')
->where('claim_status', 'pending') ->first();
->first();
if ($record && $record->compensation_amount > 0) { if ($record && $record->compensation_amount > 0) {
$lossCoverService->claim($event, $user); $lossCoverService->claim($event, $user);
Log::info("AI小班长自动领取活动补偿: Event #{$event->id}, Amount: {$record->compensation_amount}"); Log::info("AI小班长自动领取活动补偿: Event #{$event->id}, Amount: {$record->compensation_amount}");
}
} }
} }
@@ -338,8 +336,8 @@ class AiBaccaratBetJob implements ShouldQueue
$currentBank = (int) $user->bank_jjb; $currentBank = (int) $user->bank_jjb;
// 如果手上金币超过 10万,且存款未达 3000万,则进行存款 // 如果手上金币超过 10万,且存款未达 3000万,则进行存款
if ($user->jjb > 100000 && $currentBank < $bankTarget2) { if ($user->jjb > 1000000 && $currentBank < $bankTarget2) {
$depositAmount = $user->jjb - 50000; // 留 5万在手上作为本金 $depositAmount = $user->jjb - 500000; // 留 5万在手上作为本金
// 如果存款快到目标了,按需存入 // 如果存款快到目标了,按需存入
if ($currentBank < $bankTarget1 && ($currentBank + $depositAmount) > $bankTarget1) { if ($currentBank < $bankTarget1 && ($currentBank + $depositAmount) > $bankTarget1) {