From 27a73253c83cd332ad1be11aec612b80ea628e25 Mon Sep 17 00:00:00 2001 From: mehaotian <490272692@qq.com> Date: Tue, 24 Oct 2023 11:45:12 +0800 Subject: [PATCH] =?UTF-8?q?fix(stat):=20=E7=BB=9F=E8=AE=A12.0=E5=85=BC?= =?UTF-8?q?=E5=AE=B9=E6=94=AF=E4=BB=98=E5=AE=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/uni-stat/dist/uni-cloud-stat.cjs.js | 14 +++++++++++--- packages/uni-stat/dist/uni-cloud-stat.es.js | 14 +++++++++++--- packages/uni-stat/src/core/stat.js | 7 +++++++ packages/uni-stat/src/utils/pageInfo.js | 7 ++++--- 4 files changed, 33 insertions(+), 9 deletions(-) diff --git a/packages/uni-stat/dist/uni-cloud-stat.cjs.js b/packages/uni-stat/dist/uni-cloud-stat.cjs.js index d07a7a0de9..896db9fd34 100644 --- a/packages/uni-stat/dist/uni-cloud-stat.cjs.js +++ b/packages/uni-stat/dist/uni-cloud-stat.cjs.js @@ -505,13 +505,14 @@ const uni_cloud_config = () => { */ const get_space = (config) => { const uniCloudConfig = uni_cloud_config(); - const { spaceId, provider, clientSecret } = uniCloudConfig; - const space_type = ['tcb', 'tencent', 'aliyun']; + const { spaceId, provider, clientSecret ,secretKey,secretId} = uniCloudConfig; + const space_type = ['tcb', 'tencent', 'aliyun','alipay']; const is_provider = space_type.indexOf(provider) !== -1; const is_aliyun = provider === 'aliyun' && spaceId && clientSecret; const is_tcb = (provider === 'tcb' || provider === 'tencent') && spaceId; + const is_alipay = provider === 'alipay' && spaceId && secretKey && secretId; - if (is_provider && (is_aliyun || is_tcb)) { + if (is_provider && (is_aliyun || is_tcb || is_alipay)) { return uniCloudConfig } else { if (config && config.spaceId) { @@ -1348,9 +1349,16 @@ class Stat extends Report { spaceId: space.spaceId, clientSecret: space.clientSecret, }; + if (space.endpoint) { spaceData.endpoint = space.endpoint; } + + if(space.provider === 'alipay'){ + spaceData.secretId = space.secretId; + spaceData.secretKey = space.secretKey; + } + uni.__stat_uniCloud_space = uniCloud.init(spaceData); // console.log( // '=== 当前绑定的统计服务空间spaceId:' + diff --git a/packages/uni-stat/dist/uni-cloud-stat.es.js b/packages/uni-stat/dist/uni-cloud-stat.es.js index 8cd6a8b893..1d7973cdf5 100644 --- a/packages/uni-stat/dist/uni-cloud-stat.es.js +++ b/packages/uni-stat/dist/uni-cloud-stat.es.js @@ -503,13 +503,14 @@ const uni_cloud_config = () => { */ const get_space = (config) => { const uniCloudConfig = uni_cloud_config(); - const { spaceId, provider, clientSecret } = uniCloudConfig; - const space_type = ['tcb', 'tencent', 'aliyun']; + const { spaceId, provider, clientSecret ,secretKey,secretId} = uniCloudConfig; + const space_type = ['tcb', 'tencent', 'aliyun','alipay']; const is_provider = space_type.indexOf(provider) !== -1; const is_aliyun = provider === 'aliyun' && spaceId && clientSecret; const is_tcb = (provider === 'tcb' || provider === 'tencent') && spaceId; + const is_alipay = provider === 'alipay' && spaceId && secretKey && secretId; - if (is_provider && (is_aliyun || is_tcb)) { + if (is_provider && (is_aliyun || is_tcb || is_alipay)) { return uniCloudConfig } else { if (config && config.spaceId) { @@ -1346,9 +1347,16 @@ class Stat extends Report { spaceId: space.spaceId, clientSecret: space.clientSecret, }; + if (space.endpoint) { spaceData.endpoint = space.endpoint; } + + if(space.provider === 'alipay'){ + spaceData.secretId = space.secretId; + spaceData.secretKey = space.secretKey; + } + uni.__stat_uniCloud_space = uniCloud.init(spaceData); // console.log( // '=== 当前绑定的统计服务空间spaceId:' + diff --git a/packages/uni-stat/src/core/stat.js b/packages/uni-stat/src/core/stat.js index 8ac810c46a..b659207db4 100644 --- a/packages/uni-stat/src/core/stat.js +++ b/packages/uni-stat/src/core/stat.js @@ -27,9 +27,16 @@ class Stat extends Report { spaceId: space.spaceId, clientSecret: space.clientSecret, } + if (space.endpoint) { spaceData.endpoint = space.endpoint } + + if(space.provider === 'alipay'){ + spaceData.secretId = space.secretId + spaceData.secretKey = space.secretKey + } + uni.__stat_uniCloud_space = uniCloud.init(spaceData) // console.log( // '=== 当前绑定的统计服务空间spaceId:' + diff --git a/packages/uni-stat/src/utils/pageInfo.js b/packages/uni-stat/src/utils/pageInfo.js index 03f86ab7c3..680133fa54 100644 --- a/packages/uni-stat/src/utils/pageInfo.js +++ b/packages/uni-stat/src/utils/pageInfo.js @@ -475,13 +475,14 @@ export const uni_cloud_config = () => { */ export const get_space = (config) => { const uniCloudConfig = uni_cloud_config() - const { spaceId, provider, clientSecret } = uniCloudConfig - const space_type = ['tcb', 'tencent', 'aliyun'] + const { spaceId, provider, clientSecret ,secretKey,secretId} = uniCloudConfig + const space_type = ['tcb', 'tencent', 'aliyun','alipay'] const is_provider = space_type.indexOf(provider) !== -1 const is_aliyun = provider === 'aliyun' && spaceId && clientSecret const is_tcb = (provider === 'tcb' || provider === 'tencent') && spaceId + const is_alipay = provider === 'alipay' && spaceId && secretKey && secretId - if (is_provider && (is_aliyun || is_tcb)) { + if (is_provider && (is_aliyun || is_tcb || is_alipay)) { return uniCloudConfig } else { if (config && config.spaceId) { -- GitLab