优化websocket连接

This commit is contained in:
2026-04-24 15:25:15 +08:00
parent 2ce128e63a
commit 203e478b65
6 changed files with 47 additions and 2 deletions

View File

@@ -24,6 +24,7 @@ export default {
ws_connect: 'Connect WS',
ws_disconnect: 'Disconnect WS',
ws_log_empty: 'No WebSocket logs yet.',
jackpot_hit_tip: 'Jackpot winners detected in this round.',
candidate_title: 'Candidate payout estimates',
number: 'Number',
estimated_loss: 'Estimated payout',

View File

@@ -24,6 +24,7 @@ export default {
ws_connect: '连接WS',
ws_disconnect: '断开WS',
ws_log_empty: '暂无 WebSocket 日志。',
jackpot_hit_tip: '本期出现中大奖用户,请查看开奖信息。',
candidate_title: '候选号码赔付预估',
number: '号码',
estimated_loss: '预估赔付',

View File

@@ -305,6 +305,14 @@ function handleWsPayload(raw: unknown): void {
mergeLiveSnapshot(parsed.data as anyObj)
return
}
if (event === 'jackpot.hit' && parsed.data && typeof parsed.data === 'object') {
const jackpotData = parsed.data as anyObj
const hits = Array.isArray(jackpotData.hits) ? jackpotData.hits : []
if (hits.length > 0) {
ElMessage.success(t('game.live.jackpot_hit_tip'))
}
return
}
if (event === 'period.tick' && parsed.data && typeof parsed.data === 'object') {
const periodData = parsed.data as anyObj
if (typeof periodData.server_time === 'number') {