feat(workflow,corps): add dynamic staff link switching and deep failed job inspection

This commit is contained in:
gitea committed 2026-10-14 18:32:14 +08:00
1 parent 0499ccb2cc
commit 0c6a3ee660
8 files changed
+737 -32

No files matched your search

+17 -6
View File
@@ -401,6 +401,9 @@ export async function getCorpProvisionalAuthLink(
force?: boolean;
syncLocalSession?: boolean;
enterprisesDir?: string;
staffId?: string;
staffName?: string;
persistStaff?: boolean;
} = {}
): Promise<{
corpId: string;
@@ -418,7 +421,8 @@ export async function getCorpProvisionalAuthLink(
const expiresIn = parseExpiresInSeconds(explicitDuration, 7200);
const pageType = options.pageType || "home";
const corpId = corp.corpId || corp.credentials.corpId;
const staffId = corp.staffId || corp.credentials.staffId;
const targetStaffId = options.staffId || corp.staffId || corp.credentials.staffId;
const targetStaffName = options.staffName || (options.staffId ? undefined : corp.staffName || corp.session?.staffName);
const baseUrl = normalizeBaseUrl(corp.baseUrl || DEFAULT_EKB_BASE_URL);
// 1. 若尚未配置 appKey/appSecurity,先确保会话有效并尝试自动提权提取密钥
@@ -446,7 +450,7 @@ export async function getCorpProvisionalAuthLink(
baseUrl,
openapiToken,
corpId,
staffId,
staffId: targetStaffId,
expiresIn,
pageType,
});
@@ -458,6 +462,13 @@ export async function getCorpProvisionalAuthLink(
if (corp.session) {
corp.session.expTime = provisional.expiresAt;
}
if (options.persistStaff && options.staffId) {
corp.staffId = options.staffId;
corp.credentials.staffId = options.staffId;
if (options.staffName) {
corp.staffName = options.staffName;
}
}
saveCorpConfig(corp, options.enterprisesDir);
invalidateCorpSubdomainTokenCaches(corp);
}
@@ -465,8 +476,8 @@ export async function getCorpProvisionalAuthLink(
return {
corpId,
corpName: corp.name,
staffId: provisional.uid,
staffName: corp.staffName || corp.session?.staffName || undefined,
staffId: provisional.uid || targetStaffId,
staffName: targetStaffName || corp.staffName || corp.session?.staffName || undefined,
url: provisional.url,
token: provisional.token,
expiresIn: provisional.expiresIn,
@@ -511,8 +522,8 @@ export async function getCorpProvisionalAuthLink(
return {
corpId,
corpName: corp.name,
staffId,
staffName: corp.staffName || corp.session?.staffName || undefined,
staffId: targetStaffId,
staffName: targetStaffName || corp.staffName || corp.session?.staffName || undefined,
url,
token: corp.credentials.accessToken,
expiresIn: Math.max(1, Math.round((expMs - Date.now()) / 1000)),