feat:适配多租户

This commit is contained in:
dzc committed 2025-04-22 15:15:46 +08:00
1 parent cdbb69f843
commit b370be9111
13 files changed
+175 -8

No files matched your search

@@ -125,6 +125,10 @@ abstract class AppSettingTool {
static Future<void> setUserSetting(UserSetting userInfo) async {
final globalUserInfo = await getUserSetting();
if (globalUserInfo == userInfo) return;
if (ObjectUtil.isEmpty(userInfo.tenantId) &&
ObjectUtil.isNotEmpty(globalUserInfo.tenantId)) {
userInfo.tenantId = globalUserInfo.tenantId;
}
await _setSetting(userJson: userInfo);
}
+2 -2
View File
@@ -30,14 +30,14 @@ class HttpManage {
InterceptorsWrapper(
onRequest: (RequestOptions options, handler) async {
options.headers["CLIENT-TOC"] = "Y";
options.headers["TENANT-ID"] = 1;
final userInfo = await AppSettingTool.getUserSetting();
if (!options.path.contains(Constants.oauth2AppApiUrl)) {
final userInfo = await AppSettingTool.getUserSetting();
if (ObjectUtil.isNotEmpty(userInfo.accessToken)) {
options.headers['Authorization'] =
"Bearer ${userInfo.accessToken}";
}
}
options.headers["TENANT-ID"] = userInfo.tenantId ?? 1;
return handler.next(options);
},
onResponse: (e, handler) async {