From d849859c2d6900e6502a2689bb1e57128364b89c Mon Sep 17 00:00:00 2001 From: Ordinary Date: Mon, 8 Jul 2024 14:38:41 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0=E5=A4=9A=E7=A7=9F?= =?UTF-8?q?=E6=88=B7Id=E9=85=8D=E7=BD=AE=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env | 3 +++ sheep/api/infra/file.js | 8 +++++--- sheep/request/index.js | 8 +++++--- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/.env b/.env index b4ae1fd2..edcdf087 100644 --- a/.env +++ b/.env @@ -19,3 +19,6 @@ SHOPRO_STATIC_URL = https://file.sheepjs.com # 是否开启直播 1 开启直播 | 0 关闭直播 (小程序官方后台未审核开通直播权限时请勿开启) SHOPRO_MPLIVE_ON = 0 + +# 多租户配置 +TENANT_ID = 162 diff --git a/sheep/api/infra/file.js b/sheep/api/infra/file.js index a4bac46f..1d02b293 100644 --- a/sheep/api/infra/file.js +++ b/sheep/api/infra/file.js @@ -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 = { // 上传文件 @@ -15,8 +17,8 @@ const FileApi = { name: 'file', header: { // Accept: 'text/json', - Accept : '*/*', - 'tenant-id' :'1', + Accept: '*/*', + 'tenant-id': tenantId, // Authorization: 'Bearer test247', }, success: (uploadFileRes) => { diff --git a/sheep/request/index.js b/sheep/request/index.js index 99c38a4f..9fe8e75f 100644 --- a/sheep/request/index.js +++ b/sheep/request/index.js @@ -12,6 +12,8 @@ import { } from '@/sheep/hooks/useModal'; import AuthUtil from '@/sheep/api/member/auth'; +const tenantId = import.meta.env.TENANT_ID; + const options = { // 显示操作成功消息 默认不显示 showSuccess: false, @@ -97,8 +99,8 @@ http.interceptors.request.use( } // TODO 芋艿:特殊处理 config.header['Accept'] = '*/*' - config.header['tenant-id'] = '1'; - config.header['terminal'] = '20'; + config.header['tenant-id'] = tenantId; + config.header['terminal'] = '10'; // config.header['Authorization'] = 'Bearer test247'; return config; }, @@ -299,4 +301,4 @@ const request = (config) => { return http.middleware(config); }; -export default request; \ No newline at end of file +export default request;