W1-W3 实现企业微信个人应用消息通知

这个提交包含在:
2026-05-11 09:17:00 +08:00
父节点 805e050ba8
当前提交 b1ae41fa99
共修改 12 个文件,包含 869 行新增和 111 行删除
+16 -5
查看文件
@@ -61,6 +61,11 @@ async function resolveEligibleRecipients(prisma, recipientEmployeeIds) {
role_code: true,
},
},
wecom_identity_binding: {
select: {
external_user_id: true,
},
},
},
});
}
@@ -159,6 +164,9 @@ async function dispatchNotificationBatch({
const recipientRoleCodes = uniq(
eligibleRecipients.flatMap((recipient) => recipient.roles.map((role) => role.role_code)),
);
const recipientExternalUserIds = uniq(
eligibleRecipients.map((recipient) => recipient.wecom_identity_binding?.external_user_id ?? null),
);
const domainScope = resolveNotificationDomainScope(type, targetType ?? anchorNotification.target_type ?? null);
if (!domainScope) {
logger?.warn?.(
@@ -225,11 +233,14 @@ async function dispatchNotificationBatch({
payload: {
title,
body,
targetType,
targetId,
detailUrl,
},
});
targetType,
targetId,
detailUrl,
recipientEmployeeIds: recipientIds,
recipientExternalUserIds,
},
prisma,
});
} catch (error) {
result = {
ok: false,