feat:【system 系统管理】租户支持匹配多域名、微信小程序 appid 等

This commit is contained in:
YunaiV
2025-08-19 23:01:57 +08:00
parent eca7bb81d3
commit 7b76e969af
3 changed files with 80 additions and 3 deletions
+9 -3
View File
@@ -26,7 +26,8 @@ const options = {
loadingMsg: '加载中',
// 需要授权才能请求 默认放开
auth: false,
// ...
// 是否传递 token
isToken: true,
};
// Loading全局实例
@@ -90,14 +91,14 @@ http.interceptors.request.use(
}
// 增加 token 令牌、terminal 终端、tenant 租户的请求头
const token = getAccessToken();
const token = config.custom.isToken ? getAccessToken() : undefined;
if (token) {
config.header['Authorization'] = token;
}
config.header['terminal'] = getTerminal();
config.header['Accept'] = '*/*';
config.header['tenant-id'] = tenantId;
config.header['tenant-id'] = getTenantId();
return config;
},
(error) => {
@@ -297,6 +298,11 @@ export const getRefreshToken = () => {
return uni.getStorageSync('refresh-token');
};
/** 获得租户编号 */
export const getTenantId = () => {
return uni.getStorageSync('tenant-id') || tenantId;
};
const request = (config) => {
return http.middleware(config);
};