去掉 work_orders 堆访问后,JOIN 会把 orders 整表扫进 Hash Right Join。 领取页在快照新鲜时不再打上游;快手出网统一 10 秒超时。倒计时改为自适应间隔。 Co-authored-by: Cursor <cursoragent@cursor.com>
23 lines
768 B
TypeScript
23 lines
768 B
TypeScript
import { Tag } from 'antd'
|
|
import { useEffect, useState } from 'react'
|
|
|
|
import { resolveDeadlineCountdown } from '@/utils/deadline-countdown'
|
|
|
|
export function DeadlineCountdown({ deadlineAt }: { deadlineAt: string }) {
|
|
const [now, setNow] = useState(() => Date.now())
|
|
const view = resolveDeadlineCountdown(deadlineAt, now)
|
|
|
|
useEffect(() => {
|
|
const timer = window.setInterval(() => setNow(Date.now()), view.tickMs)
|
|
return () => window.clearInterval(timer)
|
|
}, [view.tickMs])
|
|
|
|
return <Tag color={view.color}>{view.label}</Tag>
|
|
}
|
|
|
|
export function formatTimeoutPolicyLabel(policy?: string) {
|
|
if (policy === 'cancel_release') return '超时取消退押金'
|
|
if (policy === 'cancel_deduct') return '超时取消扣押金'
|
|
return '超时退回大厅'
|
|
}
|