feat(auth): 超管切换账户迁至 SuperAuthController,新增多公司切换与 companyCount 并收紧 auth 白名单

This commit is contained in:
小蟑螂
2026-05-25 22:47:25 +08:00
parent d4bfa4d257
commit 2ef5b9a41a
13 changed files with 402 additions and 19 deletions
@@ -117,8 +117,19 @@ export async function getAccessCodesApi() {
/**
* 切换账户(超级管理员功能)
*/
export async function switchAccountApi(userId: number) {
return requestClient.post<AuthApi.LoginResult>(`/auth/switch/${userId}`);
export async function switchAccountApi(companyId: number, userId: number) {
return requestClient.post<AuthApi.LoginResult>(
`/super/auth/switch/company/${companyId}/user/${userId}`,
);
}
/**
* 切换公司(重新签发 token)
*/
export async function switchCompanyApi(companyId: number) {
return requestClient.post<AuthApi.LoginResult>(
`/auth/switch-company/${companyId}`,
);
}
/**
@@ -14,6 +14,13 @@ export async function getUserInfoApi() {
return requestClient.get<UserVO.UserInfoVO>('/user/info');
}
/**
* 获取当前用户可切换的可用公司列表
*/
export async function getAvailableCompaniesApi() {
return requestClient.get<Array<{ id: number; name: string }>>('/user/companies');
}
/**
* 更新用户信息
*/
@@ -12,6 +12,8 @@ export namespace UserVO {
id: number;
name: string;
};
/** 可切换的可用公司数量 */
companyCount?: number;
/** 部门id */
departmentId?: number;
/** 岗位id */