From 8cd7de9f1b78c5901fa66fcb90bc955f7e8b0ae4 Mon Sep 17 00:00:00 2001 From: zhenhui <1276357500@qq.com> Date: Fri, 6 Mar 2026 16:15:56 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E8=AE=BE=E8=AE=A1=E4=B8=AD?= =?UTF-8?q?=E5=A5=96T5=E8=8E=B7=E5=8F=96=E6=8A=BD=E5=A5=96=E5=88=B8?= =?UTF-8?q?=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/app/api/controller/GameController.php | 21 +++++++++++++++----- server/app/api/logic/PlayStartLogic.php | 2 ++ 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/server/app/api/controller/GameController.php b/server/app/api/controller/GameController.php index c188d6e..99c536c 100644 --- a/server/app/api/controller/GameController.php +++ b/server/app/api/controller/GameController.php @@ -96,6 +96,14 @@ class GameController extends OpenController } catch (ApiException $e) { return $this->fail($e->getMessage(), ReturnCode::BUSINESS_ERROR); } catch (\Throwable $e) { + // 记录抽奖逻辑抛出的真实异常,便于排查“服务超时,没有原因” + Log::error('playStart 异常: ' . $e->getMessage(), [ + 'file' => $e->getFile(), + 'line' => $e->getLine(), + 'trace' => $e->getTraceAsString(), + 'player_id' => $userId, + 'direction' => $direction, + ]); $timeoutRecord = null; $timeout_message = ''; try { @@ -104,6 +112,7 @@ class GameController extends OpenController 'lottery_config_id' => 0, 'lottery_type' => 0, 'win_coin' => 0, + 'use_coins' => 0, 'direction' => $direction, 'reward_config_id' => 0, 'start_index' => 0, @@ -111,13 +120,15 @@ class GameController extends OpenController 'roll_array' => '[]', 'status' => PlayStartLogic::RECORD_STATUS_TIMEOUT, ]); - } catch (\Exception $e) { - $timeout_message = $e->getMessage(); - Log::error("游玩记录写入超时: ". $e->getMessage()); + } catch (\Exception $inner) { + $timeout_message = $inner->getMessage(); + Log::error('游玩记录写入超时: ' . $inner->getMessage()); } - $payload = $timeoutRecord ? ['record' => $timeoutRecord->toArray()] : []; - $msg = $timeout_message !== '' ? $timeout_message : '没有原因'; + $msg = $timeout_message !== '' ? $timeout_message : $e->getMessage(); + if ($msg === '') { + $msg = '没有原因'; + } return $this->fail('服务超时,' . $msg); } } diff --git a/server/app/api/logic/PlayStartLogic.php b/server/app/api/logic/PlayStartLogic.php index 6bc5adb..80ed75b 100644 --- a/server/app/api/logic/PlayStartLogic.php +++ b/server/app/api/logic/PlayStartLogic.php @@ -148,6 +148,7 @@ class PlayStartLogic 'lottery_config_id' => $configId, 'lottery_type' => $ticketType, 'win_coin' => $winCoin, + 'use_coins' => 0, 'direction' => $direction, 'reward_config_id' => $rewardId, 'start_index' => $startIndex, @@ -210,6 +211,7 @@ class PlayStartLogic 'lottery_config_id' => $configId ?? 0, 'lottery_type' => $ticketType, 'win_coin' => 0, + 'use_coins' => 0, 'direction' => $direction, 'reward_config_id' => 0, 'start_index' => $startIndex,