1.优化websocket接口,新增赔率参数

This commit is contained in:
2026-05-15 16:24:19 +08:00
parent 575aa279bd
commit 91229f4477
13 changed files with 434 additions and 40 deletions

View File

@@ -6,6 +6,7 @@ namespace app\admin\controller\test;
use app\common\controller\Backend;
use app\common\library\admin\WebSocketConfigHelper;
use app\common\service\GameWebSocketPayloadHelper;
use support\Response;
use Webman\Http\Request as WebmanRequest;
@@ -25,6 +26,7 @@ class GameCurrentStatus extends Backend
$subscribeTopics = [
'period.tick',
'user.streak',
'period.opened',
'period.locked',
'period.payout',
@@ -33,15 +35,22 @@ class GameCurrentStatus extends Backend
'auto.spin.progress',
];
$oddsPushTopics = GameWebSocketPayloadHelper::ODDS_PUSH_TOPICS;
$testPlayerOdds = GameWebSocketPayloadHelper::adminTestPlayerOddsSnapshot();
return $this->success('', [
'name' => 'ws.period',
'ws_url' => WebSocketConfigHelper::wsUrl($request),
'connect_tip' => 'After connected, topics are auto-subscribed. You can also send subscribe manually.',
'connect_tip' => '连接成功后将自动订阅下列主题。真实业务仅在有玩家下注/结算时推送赔率;本页联调会在订阅后额外推送带 is_test/preview 的演示帧(见下方测试玩家赔率)。',
'subscribe_topics' => $subscribeTopics,
'odds_push_topics' => $oddsPushTopics,
'player_odds_fields' => ['current_streak', 'streak_level', 'odds_factor', 'is_jackpot'],
'test_player_odds' => $testPlayerOdds,
'test_push_topics' => $oddsPushTopics,
'sample_messages' => [
'{"action":"ping"}',
'{"action":"subscribe","topics":["period.tick","period.opened"]}',
'{"action":"subscribe","topics":["bet.accepted","wallet.changed","auto.spin.progress"]}',
'{"action":"subscribe","topics":["period.tick","user.streak","period.opened","period.locked","period.payout"]}',
'{"action":"subscribe","topics":["user.streak","wallet.changed","bet.accepted","auto.spin.progress"]}',
],
]);
}