feat: 新增银行卡检查插件及相关依赖与配置文件

This commit is contained in:
2026-10-29 14:21:30 +08:00
parent 0a32518060
commit c77a26cd99
494 changed files with 66923 additions and 2714 deletions
@@ -18,6 +18,21 @@ export function fmtTime(ts, fallback = '—') {
return `${pad2(d.getMonth() + 1)}-${pad2(d.getDate())} ${pad2(d.getHours())}:${pad2(d.getMinutes())}`
}
// 时间戳(秒)→ 口语化相对日期:"今天 14:30" / "昨天 09:05" / "10-20 10:00"
// 场景库卡片底部、总览「最近运行场景」表格共用,口径一致
export function fmtDayTime(ts, fallback = '—') {
if (!ts) return fallback
const d = new Date(ts * 1000)
if (isNaN(d.getTime())) return fallback
const hm = `${pad2(d.getHours())}:${pad2(d.getMinutes())}`
const now = new Date()
const dayStart = new Date(now.getFullYear(), now.getMonth(), now.getDate()).getTime()
const t = d.getTime()
if (t >= dayStart) return `今天 ${hm}`
if (t >= dayStart - 86400000) return `昨天 ${hm}`
return `${pad2(d.getMonth() + 1)}-${pad2(d.getDate())} ${hm}`
}
// 时间字符串(如后端 "2026-10-26 14:30:00")→ "10-26 14:30"
export function fmtShort(s) {
if (!s) return ''
@@ -34,6 +49,20 @@ export function durText(s) {
return m + '分' + (n % 60 ? pad2(n % 60) + 's' : '')
}
// 场景描述清洗:去掉与页头标题重复的「XQ0020 插件名:」前缀(各插件 manifest 里习惯这么写)
export function cleanDesc(desc) {
const s = String(desc || '').trim()
if (!s) return ''
return s.replace(/^XQ\d{3,4}[^::]{0,40}[::]\s*/i, '').trim()
}
// 描述拆句:manifest 的 description 常是一长串「;」句,详情弹窗按句分段更好读
export function splitDesc(desc) {
const s = cleanDesc(desc)
if (!s) return []
return s.split(/[;;]/).map((x) => x.trim()).filter(Boolean)
}
// 版本比较:数字段按 int(1.10.0 > 1.9.0),非数字段按小写字符串;对齐 electron/crypto.js 的 versionLt
export function versionLt(a, b) {
const key = (s) => String(s || '').split('.')