feat: 增加租户ID自定义配置支持

pull/62/head
downeyin 2024-07-26 00:11:07 +08:00
parent 3d7f63868f
commit 20f937a4ed
4 changed files with 14 additions and 8 deletions

3
.env
View File

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

View File

@ -1,4 +1,4 @@
import { baseUrl, apiPath } from '@/sheep/config';
import { baseUrl, apiPath, tenantId } from '@/sheep/config';
const FileApi = {
// 上传文件
@ -16,7 +16,7 @@ const FileApi = {
header: {
// Accept: 'text/json',
Accept: '*/*',
'tenant-id' :'1',
'tenant-id': tenantId,
// Authorization: 'Bearer test247',
},
success: (uploadFileRes) => {

View File

@ -11,10 +11,13 @@ console.log(`[芋道商城 ${version}] http://doc.iocoder.cn`);
export const apiPath = import.meta.env.SHOPRO_API_PATH;
export const staticUrl = import.meta.env.SHOPRO_STATIC_URL;
export const tenantId = import.meta.env.SHOPRO_TENANT_ID;
export const websocketPath = import.meta.env.SHOPRO_WEBSOCKET_PATH;
export default {
baseUrl,
apiPath,
staticUrl,
websocketPath
tenantId,
websocketPath,
};

View File

@ -4,7 +4,7 @@
*/
import Request from 'luch-request';
import { baseUrl, apiPath } from '@/sheep/config';
import { baseUrl, apiPath, tenantId } from '@/sheep/config';
import $store from '@/sheep/store';
import $platform from '@/sheep/platform';
import {
@ -96,8 +96,8 @@ http.interceptors.request.use(
config.header['Authorization'] = token;
}
// TODO 芋艿:特殊处理
config.header['Accept'] = '*/*'
config.header['tenant-id'] = '1';
config.header['Accept'] = '*/*';
config.header['tenant-id'] = tenantId;
config.header['terminal'] = '20';
// config.header['Authorization'] = 'Bearer test247';
return config;