修复(半自动履约): 稳定任务排序并拆分虎牙角色UID
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
import type { HuyaBindingDecision } from '../types/semi-auto-binding'
|
||||
|
||||
function formatDecisionTime(value: string) {
|
||||
const date = new Date(value)
|
||||
if (Number.isNaN(date.getTime())) return value
|
||||
const year = date.getFullYear()
|
||||
const month = String(date.getMonth() + 1).padStart(2, '0')
|
||||
const day = String(date.getDate()).padStart(2, '0')
|
||||
const hours = String(date.getHours()).padStart(2, '0')
|
||||
const minutes = String(date.getMinutes()).padStart(2, '0')
|
||||
const seconds = String(date.getSeconds()).padStart(2, '0')
|
||||
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`
|
||||
}
|
||||
|
||||
export function formatHuyaBindingDecisionMessage(decision: HuyaBindingDecision | null | undefined) {
|
||||
const message = String(decision?.message || '').trim()
|
||||
if (!decision || !message) return message
|
||||
|
||||
const availableAt =
|
||||
decision.rebindBlockScope === 'account'
|
||||
? decision.accountRebindAvailableAt
|
||||
: decision.rebindBlockScope === 'target_role'
|
||||
? decision.targetRoleRebindAvailableAt
|
||||
: ''
|
||||
if (!availableAt) return message
|
||||
|
||||
return `${message};预计 ${formatDecisionTime(availableAt)} 后可换绑`
|
||||
}
|
||||
Reference in New Issue
Block a user