优化游戏实时对局页面

This commit is contained in:
2026-04-21 10:02:16 +08:00
parent 17eadddaa2
commit aad00e10f8
9 changed files with 622 additions and 41 deletions

View File

@@ -10,6 +10,7 @@ use app\common\model\GameRecord;
use app\common\model\UserWalletRecord;
use app\common\service\GameHotDataCoordinator;
use app\common\service\GameHotDataRedis;
use app\common\service\GameRecordService;
use app\common\service\UserPushService;
use support\think\Db;
use Webman\Http\Request;
@@ -48,6 +49,7 @@ class Game extends MobileBase
$user = $this->auth->getUser();
return $this->mobileSuccess([
'server_time' => $now,
'runtime_enabled' => GameRecordService::isLiveRuntimeEnabled(),
'period' => [
'period_no' => (string) ($periodRow['period_no'] ?? ''),
'status' => $this->mapPeriodStatus($periodRow['status'] ?? null),
@@ -126,6 +128,7 @@ class Game extends MobileBase
$now = time();
$startAt = $this->intValue($periodRow['period_start_at'] ?? 0);
return $this->mobileSuccess([
'runtime_enabled' => GameRecordService::isLiveRuntimeEnabled(),
'period_id' => $periodRow['id'],
'period_no' => $periodRow['period_no'],
'status' => $this->mapPeriodStatus($periodRow['status'] ?? null),
@@ -168,6 +171,9 @@ class Game extends MobileBase
return $this->mobileError(1003, 'Invalid parameter value');
}
if (!GameRecordService::isLiveRuntimeEnabled()) {
return $this->mobileError(3001, 'Game is paused');
}
$period = GameRecord::where('period_no', $periodNo)->find();
if (!$period) {
return $this->mobileError(2002, 'Game period does not exist');
@@ -382,6 +388,9 @@ class Game extends MobileBase
if ($this->intValue($status) === 2 || $this->intValue($status) === 3) {
return 'settling';
}
if ($this->intValue($status) === 5) {
return 'void';
}
return 'finished';
}