diff --git a/app/Jobs/AiBaccaratBetJob.php b/app/Jobs/AiBaccaratBetJob.php index 9e13467..f2a53e8 100644 --- a/app/Jobs/AiBaccaratBetJob.php +++ b/app/Jobs/AiBaccaratBetJob.php @@ -30,6 +30,7 @@ use Illuminate\Foundation\Bus\Dispatchable; use Illuminate\Queue\InteractsWithQueue; use Illuminate\Queue\SerializesModels; use Illuminate\Support\Facades\DB; +use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Redis; class AiBaccaratBetJob implements ShouldQueue @@ -93,10 +94,13 @@ class AiBaccaratBetJob implements ShouldQueue // 5. 优先调用 AI 接口预测下注方向 $predictionService = app(BaccaratPredictionService::class); - $betType = $predictionService->predict($recentResults); + $aiPrediction = $predictionService->predict($recentResults); + $decisionSource = 'ai'; + $betType = $aiPrediction; // AI 不可用时回退本地路单决策(保底逻辑) if ($betType === null) { + $decisionSource = 'local'; $bigCount = count(array_filter($recentResults, fn (string $r) => $r === 'big')); $smallCount = count(array_filter($recentResults, fn (string $r) => $r === 'small')); @@ -113,6 +117,17 @@ class AiBaccaratBetJob implements ShouldQueue } } + // 记录 AI 小班长本次决策日志 + $labelMap = ['big' => '大', 'small' => '小', 'triple' => '豹子']; + Log::channel('daily')->info('AI小班长百家乐决策', [ + 'round_id' => $round->id, + 'decision_source' => $decisionSource === 'ai' ? 'AI接口预测' : '本地路单兜底', + 'ai_prediction' => $aiPrediction ? $labelMap[$aiPrediction] : 'null(不可用)', + 'final_bet' => $labelMap[$betType] ?? $betType, + 'bet_amount' => $amount, + 'roadmap_20' => implode('→', array_map(fn (string $r) => $labelMap[$r] ?? $r, array_reverse($recentResults))), + ]); + // 5. 执行下注 (同 BaccaratController::bet 逻辑) DB::transaction(function () use ($user, $round, $betType, $amount, $currency) { // 幂等:同一局只能下一注