From d849859c2d6900e6502a2689bb1e57128364b89c Mon Sep 17 00:00:00 2001 From: Ordinary Date: Mon, 8 Jul 2024 14:38:41 +0800 Subject: [PATCH 1/3] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0=E5=A4=9A?= =?UTF-8?q?=E7=A7=9F=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; From b80ffb8f8e6548034862a91099dfac80f0a9d925 Mon Sep 17 00:00:00 2001 From: Ordinary Date: Tue, 9 Jul 2024 15:51:26 +0800 Subject: [PATCH 2/3] =?UTF-8?q?refactor:=20=E9=85=8D=E7=BD=AE=E7=8E=AF?= =?UTF-8?q?=E5=A2=83=E5=8F=98=E9=87=8F=E4=B8=BA=E9=BB=98=E8=AE=A4=E7=A7=9F?= =?UTF-8?q?=E6=88=B7=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.env b/.env index edcdf087..bdffd88c 100644 --- a/.env +++ b/.env @@ -21,4 +21,4 @@ SHOPRO_STATIC_URL = https://file.sheepjs.com SHOPRO_MPLIVE_ON = 0 # 多租户配置 -TENANT_ID = 162 +TENANT_ID = 1 From 098089f014bdda9145cdfc856acebd783fe3b21c Mon Sep 17 00:00:00 2001 From: Ordinary Date: Thu, 11 Jul 2024 23:29:18 +0800 Subject: [PATCH 3/3] =?UTF-8?q?fix:=20=E8=A7=A3=E5=86=B3=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E4=B8=8D=E7=94=9F=E6=95=88=E7=9A=84=E9=97=AE=E9=A2=98=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env | 2 +- sheep/config/index.js | 2 ++ sheep/request/index.js | 4 +--- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.env b/.env index bdffd88c..5ca9025c 100644 --- a/.env +++ b/.env @@ -21,4 +21,4 @@ SHOPRO_STATIC_URL = https://file.sheepjs.com SHOPRO_MPLIVE_ON = 0 # 多租户配置 -TENANT_ID = 1 +SHOPRO_TENANT_ID = 1 diff --git a/sheep/config/index.js b/sheep/config/index.js index 209a9dcd..90f21c12 100644 --- a/sheep/config/index.js +++ b/sheep/config/index.js @@ -11,9 +11,11 @@ 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 default { baseUrl, apiPath, staticUrl, + tenantId }; diff --git a/sheep/request/index.js b/sheep/request/index.js index 9fe8e75f..0f42a169 100644 --- a/sheep/request/index.js +++ b/sheep/request/index.js @@ -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 { @@ -12,8 +12,6 @@ import { } from '@/sheep/hooks/useModal'; import AuthUtil from '@/sheep/api/member/auth'; -const tenantId = import.meta.env.TENANT_ID; - const options = { // 显示操作成功消息 默认不显示 showSuccess: false,