优化设计中奖T5获取抽奖券逻辑

This commit is contained in:
2026-03-06 16:15:56 +08:00
parent 27f95a303a
commit 8cd7de9f1b
2 changed files with 18 additions and 5 deletions

View File

@@ -96,6 +96,14 @@ class GameController extends OpenController
} catch (ApiException $e) { } catch (ApiException $e) {
return $this->fail($e->getMessage(), ReturnCode::BUSINESS_ERROR); return $this->fail($e->getMessage(), ReturnCode::BUSINESS_ERROR);
} catch (\Throwable $e) { } catch (\Throwable $e) {
// 记录抽奖逻辑抛出的真实异常,便于排查“服务超时,没有原因”
Log::error('playStart 异常: ' . $e->getMessage(), [
'file' => $e->getFile(),
'line' => $e->getLine(),
'trace' => $e->getTraceAsString(),
'player_id' => $userId,
'direction' => $direction,
]);
$timeoutRecord = null; $timeoutRecord = null;
$timeout_message = ''; $timeout_message = '';
try { try {
@@ -104,6 +112,7 @@ class GameController extends OpenController
'lottery_config_id' => 0, 'lottery_config_id' => 0,
'lottery_type' => 0, 'lottery_type' => 0,
'win_coin' => 0, 'win_coin' => 0,
'use_coins' => 0,
'direction' => $direction, 'direction' => $direction,
'reward_config_id' => 0, 'reward_config_id' => 0,
'start_index' => 0, 'start_index' => 0,
@@ -111,13 +120,15 @@ class GameController extends OpenController
'roll_array' => '[]', 'roll_array' => '[]',
'status' => PlayStartLogic::RECORD_STATUS_TIMEOUT, 'status' => PlayStartLogic::RECORD_STATUS_TIMEOUT,
]); ]);
} catch (\Exception $e) { } catch (\Exception $inner) {
$timeout_message = $e->getMessage(); $timeout_message = $inner->getMessage();
Log::error("游玩记录写入超时: ". $e->getMessage()); Log::error('游玩记录写入超时: ' . $inner->getMessage());
} }
$payload = $timeoutRecord ? ['record' => $timeoutRecord->toArray()] : []; $payload = $timeoutRecord ? ['record' => $timeoutRecord->toArray()] : [];
$msg = $timeout_message !== '' ? $timeout_message : '没有原因'; $msg = $timeout_message !== '' ? $timeout_message : $e->getMessage();
if ($msg === '') {
$msg = '没有原因';
}
return $this->fail('服务超时,' . $msg); return $this->fail('服务超时,' . $msg);
} }
} }

View File

@@ -148,6 +148,7 @@ class PlayStartLogic
'lottery_config_id' => $configId, 'lottery_config_id' => $configId,
'lottery_type' => $ticketType, 'lottery_type' => $ticketType,
'win_coin' => $winCoin, 'win_coin' => $winCoin,
'use_coins' => 0,
'direction' => $direction, 'direction' => $direction,
'reward_config_id' => $rewardId, 'reward_config_id' => $rewardId,
'start_index' => $startIndex, 'start_index' => $startIndex,
@@ -210,6 +211,7 @@ class PlayStartLogic
'lottery_config_id' => $configId ?? 0, 'lottery_config_id' => $configId ?? 0,
'lottery_type' => $ticketType, 'lottery_type' => $ticketType,
'win_coin' => 0, 'win_coin' => 0,
'use_coins' => 0,
'direction' => $direction, 'direction' => $direction,
'reward_config_id' => 0, 'reward_config_id' => 0,
'start_index' => $startIndex, 'start_index' => $startIndex,