v4.0.19版本提交

This commit is contained in:
2026-09-10 09:56:50 +08:00
parent 5d0beb5733
commit 1867e7ea55
23 changed files with 420 additions and 41 deletions
@@ -483,6 +483,7 @@ export class WecomMessagePushService implements OnModuleInit {
userName: '好客用户',
userPhone: '13800008000',
userRemark: '大客户',
userSource: '推广码 · 秋季品鉴',
phoneMasked: '13800008000',
},
handlePath: '/orders?orderNo=DK202608200001',
@@ -0,0 +1,20 @@
import { describe, expect, it } from 'vitest';
import { WECOM_PUSH_TEMPLATE_DEFAULTS, WECOM_PUSH_TEMPLATE_LEGACY_BODIES } from './wecom-push-template.defaults';
describe('wecom-push-template.defaults', () => {
it('order.paid 默认正文在备注下含用户来源', () => {
const paid = WECOM_PUSH_TEMPLATE_DEFAULTS.find((t) => t.eventKey === 'order.paid');
expect(paid?.body).toContain('备注:{{userRemark}}');
expect(paid?.body).toContain('用户来源:{{userSource}}');
expect(paid?.body.indexOf('备注:{{userRemark}}') ?? -1).toBeLessThan(
paid?.body.indexOf('用户来源:{{userSource}}') ?? -1,
);
});
it('上一版含备注的默认文案列入 legacy 以便启动升级', () => {
const legacy = WECOM_PUSH_TEMPLATE_LEGACY_BODIES['order.paid'] ?? [];
expect(legacy.some((body) => body.includes('备注:{{userRemark}}') && !body.includes('用户来源'))).toBe(
true,
);
});
});
@@ -22,6 +22,7 @@ export const WECOM_PUSH_TEMPLATE_DEFAULTS: WecomTemplateDefault[] = [
'收货:{{receiverInfo}}',
'用户:{{userName}} {{userPhone}}',
'备注:{{userRemark}}',
'用户来源:{{userSource}}',
'时间:{{time}}',
'[{{handleLabel}}]({{handleUrl}})',
].join('\n'),
@@ -227,6 +228,19 @@ export const WECOM_PUSH_TEMPLATE_LEGACY_BODIES: Partial<Record<WecomTemplateEven
'时间:{{time}}',
'[{{handleLabel}}]({{handleUrl}})',
].join('\n'),
[
'**订单支付成功**',
'订单号:{{orderNo}}',
'实付:¥{{payAmount}}',
'城市:{{cityName}}',
'商品:{{skuSummary}}',
'物流:{{deliveryLabel}}',
'收货:{{receiverInfo}}',
'用户:{{userName}} {{userPhone}}',
'备注:{{userRemark}}',
'时间:{{time}}',
'[{{handleLabel}}]({{handleUrl}})',
].join('\n'),
],
'redeem.success': [
[