- 资产有沉默期已过期且可延期的套餐时弹窗,带去延期入口;待实名 7 天内到截止日时提醒尽快实名 - 排在临期提醒之后、站内通知之前,同一资产同一笔套餐每天最多弹一次 - 套餐历史在后台加载,不阻塞首页其他弹窗
This commit is contained in:
@@ -9,6 +9,8 @@ import {
|
||||
isPaymentLink,
|
||||
isSilenceFeatureDisabled,
|
||||
isSilenceOrderFinal,
|
||||
pickSilenceReminder,
|
||||
silenceReminderKey,
|
||||
validateExtensionDays
|
||||
} from '../utils/silence.js';
|
||||
|
||||
@@ -63,3 +65,30 @@ test('资格原因、状态样式、订单终态与支付链接判断', () => {
|
||||
assert.equal(isPaymentLink('weixin://wxpay/bizpayurl?pr=abc'), false);
|
||||
assert.equal(isPaymentLink(''), false);
|
||||
});
|
||||
|
||||
test('首页沉默期提醒:优先已过期可延期,其次 7 天内到期的待实名,含加油包子节点', () => {
|
||||
const now = Date.parse('2026-11-07T10:00:00+08:00');
|
||||
const node = (id, silence, children = []) => ({ package_usage_id: id, package_name: `套餐${id}`, silence, children });
|
||||
assert.equal(pickSilenceReminder([], now), null);
|
||||
assert.equal(pickSilenceReminder([node(1, null)], now), null);
|
||||
assert.equal(pickSilenceReminder([node(1, { silence_status: 'expired', extendable: false })], now), null);
|
||||
|
||||
const expired = pickSilenceReminder([
|
||||
node(1, { silence_status: 'waiting', silence_deadline_at: '2026-11-09T23:59:59+08:00' }),
|
||||
node(2, null, [node(3, { silence_status: 'expired', extendable: true, silence_deadline_at: '2026-11-06T23:59:59+08:00' })])
|
||||
], now);
|
||||
assert.equal(expired.kind, 'expired');
|
||||
assert.equal(expired.packageUsageId, 3);
|
||||
|
||||
const waiting = pickSilenceReminder([
|
||||
node(4, { silence_status: 'waiting', silence_deadline_at: '2026-11-20T23:59:59+08:00' }),
|
||||
node(5, { silence_status: 'waiting', silence_deadline_at: '2026-11-12T23:59:59+08:00' }),
|
||||
node(6, { silence_status: 'waiting', silence_deadline_at: '2026-11-09T23:59:59+08:00' })
|
||||
], now);
|
||||
assert.equal(waiting.kind, 'waiting');
|
||||
assert.equal(waiting.packageUsageId, 6);
|
||||
assert.equal(waiting.remainingDays, 3);
|
||||
|
||||
assert.equal(pickSilenceReminder([node(7, { silence_status: 'ended' })], now), null);
|
||||
assert.equal(silenceReminderKey('A', { packageUsageId: 3, kind: 'expired' }, '2026-11-07'), 'silence_reminder:A:3:expired:2026-11-07');
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user