W1-W3 实现企业微信个人应用消息通知
这个提交包含在:
@@ -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,
|
||||
|
||||
在新工单中引用
屏蔽一个用户