1.修复自动创建下一期bug
This commit is contained in:
@@ -280,6 +280,7 @@ let clockTimer: number | null = null
|
||||
let payoutStuckRefreshTimer: number | null = null
|
||||
let drawStuckRefreshTimer: number | null = null
|
||||
let drawStuckSeconds = 0
|
||||
let payoutPhaseStuckSeconds = 0
|
||||
let fallbackPollTimer: number | null = null
|
||||
let betStreamRefreshTimer: number | null = null
|
||||
/** 合并并发 snapshot 请求,避免 axios 重复请求取消导致控制台报错 */
|
||||
@@ -352,6 +353,25 @@ function handleWsPayload(raw: unknown): void {
|
||||
void loadSnapshot({ force: true })
|
||||
return
|
||||
}
|
||||
if (event === 'admin.live.finalized' && parsed.data && typeof parsed.data === 'object') {
|
||||
const fin = parsed.data as anyObj
|
||||
if (toBool(fin.maintenance_ui) === true) {
|
||||
snapshot.is_payout_phase = false
|
||||
snapshot.payout_remaining_seconds = 0
|
||||
}
|
||||
void loadSnapshot({ force: true })
|
||||
return
|
||||
}
|
||||
if (event === 'period.payout' && parsed.data && typeof parsed.data === 'object') {
|
||||
mergePeriodPayoutTick(parsed.data as anyObj)
|
||||
const payoutData = parsed.data as anyObj
|
||||
if (typeof payoutData.result_number === 'number') {
|
||||
snapshot.result_number = payoutData.result_number
|
||||
calcResultNumber.value = payoutData.result_number
|
||||
}
|
||||
snapshot.is_payout_phase = true
|
||||
return
|
||||
}
|
||||
if (event === 'bet.win' && parsed.data && typeof parsed.data === 'object') {
|
||||
const winData = parsed.data as anyObj
|
||||
if (winData.is_jackpot === true) {
|
||||
@@ -419,7 +439,11 @@ function mergePeriodPayoutTick(data: anyObj): void {
|
||||
const remain = numberValue(data.payout_remaining_seconds)
|
||||
if (remain !== null) {
|
||||
snapshot.payout_remaining_seconds = Math.max(0, remain)
|
||||
snapshot.is_payout_phase = remain > 0 || snapshot.is_payout_phase === true
|
||||
snapshot.is_payout_phase = remain > 0
|
||||
}
|
||||
const until = readPayoutUntilUnix(data)
|
||||
if (until !== null && snapshot.record && typeof snapshot.record === 'object') {
|
||||
snapshot.record.payout_until = until
|
||||
}
|
||||
}
|
||||
|
||||
@@ -437,10 +461,10 @@ function handlePeriodTickEvent(periodData: anyObj): void {
|
||||
void loadSnapshot({ force: true })
|
||||
return
|
||||
}
|
||||
if (status === 'finished' && snapshot.is_payout_phase) {
|
||||
if (!wsConnected.value) {
|
||||
void loadSnapshot()
|
||||
}
|
||||
if (status === 'finished') {
|
||||
snapshot.is_payout_phase = false
|
||||
snapshot.payout_remaining_seconds = 0
|
||||
void loadSnapshot({ force: true })
|
||||
return
|
||||
}
|
||||
if (currentNo === '' && periodNo !== '' && !runtimeOff) {
|
||||
@@ -709,6 +733,11 @@ function mergeLiveSnapshot(data: anyObj): void {
|
||||
const serverMaintenance = data.maintenance_ui === true
|
||||
if (runtimeOff && serverMaintenance) {
|
||||
snapshot.record = null
|
||||
snapshot.is_payout_phase = false
|
||||
snapshot.payout_remaining_seconds = 0
|
||||
snapshot.can_calculate = false
|
||||
snapshot.can_draw = false
|
||||
snapshot.can_schedule_draw = false
|
||||
} else {
|
||||
snapshot.record = data.record
|
||||
}
|
||||
@@ -1023,6 +1052,24 @@ function isPrePayoutDrawStuck(): boolean {
|
||||
return st === 0 || st === 1
|
||||
}
|
||||
|
||||
/** 派彩倒计时已为 0 但 is_payout_phase 仍为 true(关服排水时常见) */
|
||||
function tickPayoutPhaseStuckRecovery(): void {
|
||||
if (!snapshot.is_payout_phase) {
|
||||
payoutPhaseStuckSeconds = 0
|
||||
return
|
||||
}
|
||||
const remain = payoutRemainingLive.value
|
||||
if (remain === null || remain > 0) {
|
||||
payoutPhaseStuckSeconds = 0
|
||||
return
|
||||
}
|
||||
payoutPhaseStuckSeconds++
|
||||
if (payoutPhaseStuckSeconds >= 4) {
|
||||
payoutPhaseStuckSeconds = 0
|
||||
void loadSnapshot({ force: true })
|
||||
}
|
||||
}
|
||||
|
||||
function tickPrePayoutDrawStuckRecovery(): void {
|
||||
if (!isPrePayoutDrawStuck()) {
|
||||
drawStuckSeconds = 0
|
||||
@@ -1051,6 +1098,7 @@ onMounted(async () => {
|
||||
clockTimer = window.setInterval(() => {
|
||||
clockTick.value++
|
||||
tickPrePayoutDrawStuckRecovery()
|
||||
tickPayoutPhaseStuckRecovery()
|
||||
}, 1000)
|
||||
fallbackPollTimer = window.setInterval(() => {
|
||||
if (!wsConnected.value) {
|
||||
|
||||
Reference in New Issue
Block a user