feat: 增加多租户Id配置。

pull/57/head
Ordinary 2024-07-08 14:38:41 +08:00
parent 6550441bc9
commit d849859c2d
3 changed files with 13 additions and 6 deletions

3
.env
View File

@ -19,3 +19,6 @@ SHOPRO_STATIC_URL = https://file.sheepjs.com
# 是否开启直播 1 开启直播 | 0 关闭直播 (小程序官方后台未审核开通直播权限时请勿开启) # 是否开启直播 1 开启直播 | 0 关闭直播 (小程序官方后台未审核开通直播权限时请勿开启)
SHOPRO_MPLIVE_ON = 0 SHOPRO_MPLIVE_ON = 0
# 多租户配置
TENANT_ID = 162

View File

@ -1,4 +1,6 @@
import { baseUrl, apiPath } from '@/sheep/config'; import { apiPath, baseUrl } from '@/sheep/config';
const tenantId = import.meta.env.TENANT_ID;
const FileApi = { const FileApi = {
// 上传文件 // 上传文件
@ -15,8 +17,8 @@ const FileApi = {
name: 'file', name: 'file',
header: { header: {
// Accept: 'text/json', // Accept: 'text/json',
Accept : '*/*', Accept: '*/*',
'tenant-id' :'1', 'tenant-id': tenantId,
// Authorization: 'Bearer test247', // Authorization: 'Bearer test247',
}, },
success: (uploadFileRes) => { success: (uploadFileRes) => {

View File

@ -12,6 +12,8 @@ import {
} from '@/sheep/hooks/useModal'; } from '@/sheep/hooks/useModal';
import AuthUtil from '@/sheep/api/member/auth'; import AuthUtil from '@/sheep/api/member/auth';
const tenantId = import.meta.env.TENANT_ID;
const options = { const options = {
// 显示操作成功消息 默认不显示 // 显示操作成功消息 默认不显示
showSuccess: false, showSuccess: false,
@ -97,8 +99,8 @@ http.interceptors.request.use(
} }
// TODO 芋艿:特殊处理 // TODO 芋艿:特殊处理
config.header['Accept'] = '*/*' config.header['Accept'] = '*/*'
config.header['tenant-id'] = '1'; config.header['tenant-id'] = tenantId;
config.header['terminal'] = '20'; config.header['terminal'] = '10';
// config.header['Authorization'] = 'Bearer test247'; // config.header['Authorization'] = 'Bearer test247';
return config; return config;
}, },