WCFB 复用工作台企微打卡同步密钥
这个提交包含在:
@@ -40,6 +40,13 @@ function sanitizeCheckinApiResponse(payload) {
|
||||
return Object.keys(result).length ? result : null;
|
||||
}
|
||||
|
||||
function resolveCheckinSecret(config) {
|
||||
return (
|
||||
toSafeString(config?.wecomCheckinSecret, 500) ||
|
||||
toSafeString(config?.wecomAgentSecret, 500)
|
||||
);
|
||||
}
|
||||
|
||||
function normalizeCheckinRecord(raw, { employeeByExternalUserId, timeZone }) {
|
||||
const externalUserId = toSafeString(raw?.userid ?? raw?.UserId, 128);
|
||||
const employee = employeeByExternalUserId.get(externalUserId);
|
||||
@@ -82,13 +89,14 @@ async function fetchWecomCheckinData({
|
||||
response: null,
|
||||
};
|
||||
}
|
||||
if (!toSafeString(config?.wecomCheckinSecret, 500)) {
|
||||
const checkinSecret = resolveCheckinSecret(config);
|
||||
if (!checkinSecret) {
|
||||
return {
|
||||
ok: false,
|
||||
skipped: true,
|
||||
retryable: false,
|
||||
code: "wecom_checkin_secret_missing",
|
||||
message: "Missing WECOM_CHECKIN_SECRET",
|
||||
message: "Missing WECOM_CHECKIN_SECRET or WECOM_AGENT_SECRET",
|
||||
records: [],
|
||||
response: null,
|
||||
};
|
||||
@@ -108,7 +116,7 @@ async function fetchWecomCheckinData({
|
||||
const tokenResult = await getWecomAppAccessToken({
|
||||
config: {
|
||||
...config,
|
||||
wecomAgentSecret: config.wecomCheckinSecret,
|
||||
wecomAgentSecret: checkinSecret,
|
||||
},
|
||||
timeoutMs: config.wecomRequestTimeoutMs ?? 5000,
|
||||
fetchImpl,
|
||||
@@ -177,5 +185,6 @@ module.exports = {
|
||||
fetchWecomCheckinData,
|
||||
formatDateInTimezone,
|
||||
normalizeCheckinRecord,
|
||||
resolveCheckinSecret,
|
||||
sanitizeCheckinApiResponse,
|
||||
};
|
||||
|
||||
在新工单中引用
屏蔽一个用户