提交 e66b701f 编写于 作者: M mehaotian

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

上级 a18fd3c1
......@@ -5,13 +5,13 @@
*/
const sys = uni.getSystemInfoSync();
// 访问开始即启动小程序,访问结束结分为:进入后台超过5min、在前台无任何操作超过30min、在新的来源打开小程序;
const STAT_VERSION = process.env.UNI_COMPILER_VERSION;
const STAT_URL = 'https://tongji.dcloud.io/uni/stat';
const STAT_H5_URL = 'https://tongji.dcloud.io/uni/stat.gif';
const PAGE_PVER_TIME = 1800; // 页面在前台无操作结束访问时间 单位s
const APP_PVER_TIME = 300; // 应用在后台结束访问时间 单位s
const OPERATING_TIME = 10; // 数据上报时间 单位s
// 访问开始即启动小程序,访问结束结分为:进入后台超过5min、在前台无任何操作超过30min、在新的来源打开小程序;
const STAT_VERSION = process.env.UNI_COMPILER_VERSION;
const STAT_URL = 'https://tongji.dcloud.io/uni/stat';
const STAT_H5_URL = 'https://tongji.dcloud.io/uni/stat.gif';
const PAGE_PVER_TIME = 1800; // 页面在前台无操作结束访问时间 单位s
const APP_PVER_TIME = 300; // 应用在后台结束访问时间 单位s
const OPERATING_TIME = 10; // 数据上报时间 单位s
const DIFF_TIME = 60 * 1000 * 60 * 24;
const appid = process.env.UNI_APP_ID; // 做应用隔离
......@@ -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:' +
......
......@@ -3,13 +3,13 @@
*/
const sys = uni.getSystemInfoSync();
// 访问开始即启动小程序,访问结束结分为:进入后台超过5min、在前台无任何操作超过30min、在新的来源打开小程序;
const STAT_VERSION = process.env.UNI_COMPILER_VERSION;
const STAT_URL = 'https://tongji.dcloud.io/uni/stat';
const STAT_H5_URL = 'https://tongji.dcloud.io/uni/stat.gif';
const PAGE_PVER_TIME = 1800; // 页面在前台无操作结束访问时间 单位s
const APP_PVER_TIME = 300; // 应用在后台结束访问时间 单位s
const OPERATING_TIME = 10; // 数据上报时间 单位s
// 访问开始即启动小程序,访问结束结分为:进入后台超过5min、在前台无任何操作超过30min、在新的来源打开小程序;
const STAT_VERSION = process.env.UNI_COMPILER_VERSION;
const STAT_URL = 'https://tongji.dcloud.io/uni/stat';
const STAT_H5_URL = 'https://tongji.dcloud.io/uni/stat.gif';
const PAGE_PVER_TIME = 1800; // 页面在前台无操作结束访问时间 单位s
const APP_PVER_TIME = 300; // 应用在后台结束访问时间 单位s
const OPERATING_TIME = 10; // 数据上报时间 单位s
const DIFF_TIME = 60 * 1000 * 60 * 24;
const appid = process.env.UNI_APP_ID; // 做应用隔离
......@@ -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:' +
......
......@@ -5,13 +5,13 @@
*/
const sys = uni.getSystemInfoSync();
// 访问开始即启动小程序,访问结束结分为:进入后台超过5min、在前台无任何操作超过30min、在新的来源打开小程序;
const STAT_VERSION = process.env.UNI_COMPILER_VERSION;
const STAT_URL = 'https://tongji.dcloud.io/uni/stat';
const STAT_H5_URL = 'https://tongji.dcloud.io/uni/stat.gif';
const PAGE_PVER_TIME = 1800; // 页面在前台无操作结束访问时间 单位s
const APP_PVER_TIME = 300; // 应用在后台结束访问时间 单位s
const OPERATING_TIME = 10; // 数据上报时间 单位s
// 访问开始即启动小程序,访问结束结分为:进入后台超过5min、在前台无任何操作超过30min、在新的来源打开小程序;
const STAT_VERSION = process.env.UNI_COMPILER_VERSION;
const STAT_URL = 'https://tongji.dcloud.io/uni/stat';
const STAT_H5_URL = 'https://tongji.dcloud.io/uni/stat.gif';
const PAGE_PVER_TIME = 1800; // 页面在前台无操作结束访问时间 单位s
const APP_PVER_TIME = 300; // 应用在后台结束访问时间 单位s
const OPERATING_TIME = 10; // 数据上报时间 单位s
const DIFF_TIME = 60 * 1000 * 60 * 24;
const appid = process.env.UNI_APP_ID; // 做应用隔离
......
......@@ -3,13 +3,13 @@
*/
const sys = uni.getSystemInfoSync();
// 访问开始即启动小程序,访问结束结分为:进入后台超过5min、在前台无任何操作超过30min、在新的来源打开小程序;
const STAT_VERSION = process.env.UNI_COMPILER_VERSION;
const STAT_URL = 'https://tongji.dcloud.io/uni/stat';
const STAT_H5_URL = 'https://tongji.dcloud.io/uni/stat.gif';
const PAGE_PVER_TIME = 1800; // 页面在前台无操作结束访问时间 单位s
const APP_PVER_TIME = 300; // 应用在后台结束访问时间 单位s
const OPERATING_TIME = 10; // 数据上报时间 单位s
// 访问开始即启动小程序,访问结束结分为:进入后台超过5min、在前台无任何操作超过30min、在新的来源打开小程序;
const STAT_VERSION = process.env.UNI_COMPILER_VERSION;
const STAT_URL = 'https://tongji.dcloud.io/uni/stat';
const STAT_H5_URL = 'https://tongji.dcloud.io/uni/stat.gif';
const PAGE_PVER_TIME = 1800; // 页面在前台无操作结束访问时间 单位s
const APP_PVER_TIME = 300; // 应用在后台结束访问时间 单位s
const OPERATING_TIME = 10; // 数据上报时间 单位s
const DIFF_TIME = 60 * 1000 * 60 * 24;
const appid = process.env.UNI_APP_ID; // 做应用隔离
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册