fix(qqmusic): 金币单独成组渲染,不混进成长值里
renderAccount 原来把所有 done 的 step 平铺,金币签到会显示成
「✓ 金币签到 已签 + 30 金币」夹在成长值中间,容易被读成成长值 +30。
改成按 name 前缀 /^金币/ 分组:
- 成长值那几行走原来的 done/warn/skip 三态
- 金币单独一行 💰 金币:签到 已签 + 30 金币 / 抽奖签到 已签 + 已领
- 金币全 skip 时收成一行「· 金币:今日已签」
- 金币失败仍按 warn/fail 单独列出(带 ActID 过期的提示)
顺带导出 renderAccount 供测试直接渲染。
This commit is contained in:
@@ -984,15 +984,29 @@ function pushCardResult(results) {
|
||||
* 全部 skip 的项折叠成一行,避免通知被十几行「今日已完成」淹没。 */
|
||||
function renderAccount(uin, r) {
|
||||
const icon = { done: '✓', warn: '△', fail: '✗', skip: '·' }
|
||||
const did = r.steps.filter(s => s.status === 'done')
|
||||
const warn = r.steps.filter(s => s.status === 'warn' || s.status === 'fail')
|
||||
const skip = r.steps.filter(s => s.status === 'skip')
|
||||
// 金币体系的 step 名字都以「金币」开头 —— 单独成组,别混进成长值里让人误读
|
||||
const isCoin = s => /^金币/.test(s.name)
|
||||
const coin = r.steps.filter(isCoin)
|
||||
const rest = r.steps.filter(s => !isCoin(s))
|
||||
const did = rest.filter(s => s.status === 'done')
|
||||
const warn = rest.filter(s => s.status === 'warn' || s.status === 'fail')
|
||||
const skip = rest.filter(s => s.status === 'skip')
|
||||
const lines = [`${r.verdict === 'done' ? '🟢' : '🟡'} ${uin}:成长值 +${r.total}`]
|
||||
for (const s of did) lines.push(` ${icon.done} ${s.name}${s.detail ? ` ${s.detail}` : ''}`)
|
||||
for (const s of warn) lines.push(` ${icon[s.status]} ${s.name}${s.detail ? ` ${s.detail}` : ''}`)
|
||||
if (skip.length) {
|
||||
lines.push(` ${icon.skip} 无需处理 ${skip.length} 项:${skip.map(s => s.name).join('、')}`)
|
||||
}
|
||||
// 金币单独一行:它不加成长值,混在上面会被当成成长值的一部分
|
||||
if (coin.length) {
|
||||
const doneCoin = coin.filter(s => s.status === 'done')
|
||||
const badCoin = coin.filter(s => s.status === 'warn' || s.status === 'fail')
|
||||
if (doneCoin.length) {
|
||||
lines.push(` 💰 金币:${doneCoin.map(s => `${s.name.replace(/^金币/, '') || '签到'}${s.detail ? ` ${s.detail}` : ''}`).join(' / ')}`)
|
||||
}
|
||||
for (const s of badCoin) lines.push(` ${icon[s.status]} ${s.name}${s.detail ? ` ${s.detail}` : ''}`)
|
||||
if (!doneCoin.length && !badCoin.length) lines.push(` · 金币:今日已签`)
|
||||
}
|
||||
if (r.cardUrl) lines.push(` 🎁 分享卡 ${r.cardUrl}`)
|
||||
return lines.join('\n')
|
||||
}
|
||||
@@ -1077,4 +1091,4 @@ async function main() {
|
||||
if (require.main === module) {
|
||||
main().catch(e => { console.error('[QQ音乐] 未捕获异常:', e); process.exitCode = 1 })
|
||||
}
|
||||
module.exports = { time33, zzc, QMClient, parseAccounts, pushCardResult }
|
||||
module.exports = { time33, zzc, QMClient, parseAccounts, pushCardResult, renderAccount }
|
||||
|
||||
Reference in New Issue
Block a user