diff --git a/packages/uni-cli-shared/src/json/app/manifest/plus.ts b/packages/uni-cli-shared/src/json/app/manifest/plus.ts index 0752417dd16e00e1fd2d6bbac34d34bd0c63fbd0..35ed9ac38c546a976ca0eccaa36f55359a4bd585 100644 --- a/packages/uni-cli-shared/src/json/app/manifest/plus.ts +++ b/packages/uni-cli-shared/src/json/app/manifest/plus.ts @@ -106,22 +106,22 @@ function initUniStatistics(manifestJson: Record) { ) delete manifestJson.uniStatistics } - if (!process.env.UNI_CLOUD_SPACES) { + if (!process.env.UNI_CLOUD_PROVIDER) { return } let spaces = [] try { - spaces = JSON.parse(process.env.UNI_CLOUD_SPACES) + spaces = JSON.parse(process.env.UNI_CLOUD_PROVIDER) } catch (e: any) {} if (!isArray(spaces) || !spaces.length) { return } const space = spaces[0] as { - provider?: string - id: string - name: string + provider: string + spaceId: string + spaceName: string clientSecret?: string - apiEndpoint?: string + endpoint?: string } if (!space) { return @@ -136,9 +136,9 @@ function initUniStatistics(manifestJson: Record) { } uniStatistics.uniCloud = { provider: space.provider, - spaceId: space.id, + spaceId: space.spaceId, clientSecret: space.clientSecret, - endpoint: space.apiEndpoint, + endpoint: space.endpoint, } } } diff --git a/packages/uni-cloud/src/uni.plugin.ts b/packages/uni-cloud/src/uni.plugin.ts index fdc28dd39c45265df78709536f5d4e442d6787da..5c1072c8414a57b24a06b853ec6c695a6b0e06da 100644 --- a/packages/uni-cloud/src/uni.plugin.ts +++ b/packages/uni-cloud/src/uni.plugin.ts @@ -13,8 +13,6 @@ import { import { uniValidateFunctionPlugin } from './validateFunction' -process.env.UNI_CLOUD_PROVIDER = JSON.stringify([]) - const uniCloudSpaces: { provider?: string id: string @@ -126,6 +124,17 @@ function checkUniModules() { function initUniCloudEnv() { checkUniModules() + if (process.env.UNI_CLOUD_PROVIDER) { + const spaces = JSON.parse(process.env.UNI_CLOUD_PROVIDER) + if (!isArray(spaces)) { + return + } + if (spaces.length) { + uniCloudSpaces.push(...spaces) + return + } + } + process.env.UNI_CLOUD_PROVIDER = JSON.stringify([]) if (!process.env.UNI_CLOUD_SPACES) { return } diff --git a/packages/uni-stat/src/utils/pageInfo.js b/packages/uni-stat/src/utils/pageInfo.js index af00ae34d23114643a275a3c7f3135630603d429..d4f2a2c730f06e9643cf04b5e428e6c23c818974 100644 --- a/packages/uni-stat/src/utils/pageInfo.js +++ b/packages/uni-stat/src/utils/pageInfo.js @@ -453,10 +453,10 @@ export const uni_cloud_config = () => { export const get_space = (config) => { const uniCloudConfig = uni_cloud_config() const { spaceId, provider, clientSecret } = uniCloudConfig - const space_type = ['tcb', 'aliyun'] + const space_type = ['tcb', 'tencent', 'aliyun'] const is_provider = space_type.indexOf(provider) !== -1 const is_aliyun = provider === 'aliyun' && spaceId && clientSecret - const is_tcb = provider === 'tcb' && spaceId + const is_tcb = (provider === 'tcb' || provider === 'tencent') && spaceId if (is_provider && (is_aliyun || is_tcb)) { return uniCloudConfig