v4.0.19版本提交
This commit is contained in:
@@ -38,6 +38,18 @@ export const USER_SOURCE_TYPE_LABELS: Record<UserSourceType, string> = {
|
||||
[UserSourceType.OTHER]: '其他',
|
||||
};
|
||||
|
||||
/** 成交播报等单行展示:类型中文 + 可选来源标签 */
|
||||
export function formatUserSourceLine(
|
||||
sourceType?: string | null,
|
||||
sourceLabel?: string | null,
|
||||
): string {
|
||||
const type = String(sourceType || '').trim();
|
||||
const typeLabel =
|
||||
(type && USER_SOURCE_TYPE_LABELS[type as UserSourceType]) || type || '—';
|
||||
const label = String(sourceLabel || '').trim();
|
||||
return label ? `${typeLabel} · ${label}` : typeLabel;
|
||||
}
|
||||
|
||||
export enum SmsScene {
|
||||
USER_LOGIN = 'USER_LOGIN',
|
||||
STORE_LOGIN = 'STORE_LOGIN',
|
||||
|
||||
@@ -7,6 +7,7 @@ import {
|
||||
WECOM_TEMPLATE_PLACEHOLDERS,
|
||||
parseWecomPushConditions,
|
||||
} from './wecom-message-push';
|
||||
import { formatUserSourceLine } from './enums';
|
||||
|
||||
describe('wecom-message-push', () => {
|
||||
it('alert.settlement 展示为结算任务失败通知且在系统监控组', () => {
|
||||
@@ -35,13 +36,15 @@ describe('wecom-message-push', () => {
|
||||
]);
|
||||
});
|
||||
|
||||
it('支付与核销模板含昵称、明文手机、备注占位符', () => {
|
||||
it('支付模板含用户来源占位符', () => {
|
||||
expect(WECOM_TEMPLATE_PLACEHOLDERS['order.paid']).toEqual(
|
||||
expect.arrayContaining(['userName', 'userPhone', 'userRemark']),
|
||||
expect.arrayContaining(['userName', 'userPhone', 'userRemark', 'userSource']),
|
||||
);
|
||||
expect(WECOM_TEMPLATE_PLACEHOLDERS['redeem.success']).toEqual(
|
||||
expect.arrayContaining(['userName', 'userPhone', 'userRemark']),
|
||||
);
|
||||
expect(formatUserSourceLine('PROMO_CODE', '秋季品鉴')).toBe('推广码 · 秋季品鉴');
|
||||
expect(formatUserSourceLine('ORGANIC', '')).toBe('自然流量');
|
||||
});
|
||||
|
||||
it('结算账单模板含累计金额与明细摘要', () => {
|
||||
|
||||
@@ -200,6 +200,7 @@ export const WECOM_TEMPLATE_PLACEHOLDERS: Record<WecomTemplateEventKey, string[]
|
||||
'userName',
|
||||
'userPhone',
|
||||
'userRemark',
|
||||
'userSource',
|
||||
'phoneMasked',
|
||||
'time',
|
||||
'handleUrl',
|
||||
|
||||
Reference in New Issue
Block a user