提交 27a73253 编写于 作者: M mehaotian

fix(stat): 统计2.0兼容支付宝

上级 4976b23d
......@@ -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:' +
......
......@@ -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:' +
......
......@@ -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:' +
......
......@@ -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) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册