v3.5.11企业微信通知调整
CI / verify (pull_request) Waiting to run

This commit is contained in:
2026-08-26 09:55:19 +08:00
parent 632539e8dc
commit 3afbdfe6b9
17 changed files with 775 additions and 83 deletions
@@ -24,6 +24,7 @@ import {
normalizeTestPhone,
} from '../../common/test-whitelist/test-whitelist.service';
import { WecomMessagePushService } from '../../integrations/wecom/wecom-message-push.service';
import { formatPartnerWecomLabel } from './wecom-submitter-label';
function haversineMeters(lat1: number, lng1: number, lat2: number, lng2: number): number {
const toRad = (d: number) => (d * Math.PI) / 180;
@@ -76,25 +77,29 @@ export class StoreService {
private readonly wecomPush: WecomMessagePushService,
) {}
/** 门店进入 PENDING 时通知企微(失败不挡业务) */
/** 门店进入 PENDING 或 HQ 新建时通知企微(失败不挡业务) */
private notifyStoreAuditPending(opts: {
storeId: bigint;
storeName: string;
cityName?: string | null;
partnerLabel?: string | null;
submitter?: string | null;
submitType: '新建' | '重提';
handlePath?: string;
}) {
void this.wecomPush.dispatchEvent(
'store.audit_pending',
{
storeName: opts.storeName,
cityName: opts.cityName || '—',
submitter: opts.submitter || opts.partnerLabel || '—',
partnerLabel: opts.partnerLabel || '—',
action: opts.submitType,
storeId: opts.storeId.toString(),
},
{
handlePath: `/stores?auditStatus=PENDING&storeId=${opts.storeId.toString()}`,
handlePath:
opts.handlePath || `/stores?auditStatus=PENDING&storeId=${opts.storeId.toString()}`,
},
);
}
@@ -587,15 +592,16 @@ export class StoreService {
});
if (!this.config.autoApproveStore) {
const partner = await this.prisma.partnerAccount.findUnique({
where: { id: primaryId },
select: { name: true, phone: true },
});
const [submitter, partnerLabel] = await Promise.all([
formatPartnerWecomLabel(this.prisma, partnerAccountId),
formatPartnerWecomLabel(this.prisma, primaryId),
]);
this.notifyStoreAuditPending({
storeId: store.id,
storeName: store.name,
cityName: store.cityName,
partnerLabel: partner?.name || partner?.phone || String(primaryId),
submitter,
partnerLabel,
submitType: '新建',
});
}
@@ -757,15 +763,16 @@ export class StoreService {
remark: '合伙人修改资料后重新提交审核',
},
});
const partner = await this.prisma.partnerAccount.findUnique({
where: { id: primaryId },
select: { name: true, phone: true },
});
const [submitter, partnerLabel] = await Promise.all([
formatPartnerWecomLabel(this.prisma, partnerAccountId),
formatPartnerWecomLabel(this.prisma, primaryId),
]);
this.notifyStoreAuditPending({
storeId: updated.id,
storeName: updated.name,
cityName: updated.cityName,
partnerLabel: partner?.name || partner?.phone || String(primaryId),
submitter,
partnerLabel,
submitType: '重提',
});
}
@@ -882,15 +889,16 @@ export class StoreService {
remark: '合伙人重新上传资料后重新提交审核',
},
});
const partner = await this.prisma.partnerAccount.findUnique({
where: { id: primaryId },
select: { name: true, phone: true },
});
const [submitter, partnerLabel] = await Promise.all([
formatPartnerWecomLabel(this.prisma, partnerAccountId),
formatPartnerWecomLabel(this.prisma, primaryId),
]);
this.notifyStoreAuditPending({
storeId: store.id,
storeName: store.name,
cityName: store.cityName,
partnerLabel: partner?.name || partner?.phone || String(primaryId),
submitter,
partnerLabel,
submitType: '重提',
});
}