提交 ea46ae7f 编写于 作者: M mehaotian

fest(stat): 新增 采集项- uniPushClientID 配置

上级 bab5dcaf
......@@ -474,7 +474,6 @@ const is_debug = debug;
* @param {*} data
*/
const log = (data, type) => {
let msg_type = '';
switch (data.lt) {
case '1':
......@@ -500,7 +499,7 @@ const log = (data, type) => {
// #ifdef APP
// 在 app 中,日志转为 字符串
if(typeof data === 'object') {
if (typeof data === 'object') {
data = JSON.stringify(data);
}
// #endif
......@@ -532,6 +531,17 @@ const get_report_Interval = (defaultTime) => {
// 如果不是整数,则默认为上报间隔时间
if (!reg.test(time)) return defaultTime
return Number(time)
};
/**
* 获取隐私协议配置
*/
const is_push_clientid = () => {
if (uniStatisticsConfig.collectItems) {
const ClientID = uniStatisticsConfig.collectItems.uniPushClientID;
return typeof ClientID === 'boolean' ? ClientID : false
}
return false
};
const appid = process.env.UNI_APP_ID; // 做应用隔离
......@@ -1304,7 +1314,8 @@ class Stat extends Report {
* 获取推送id
*/
pushEvent(options) {
if (uni.getPushClientId) {
const ClientID = is_push_clientid();
if (uni.getPushClientId && ClientID) {
uni.getPushClientId({
success: (res) => {
const cid = res.cid || false;
......
......@@ -472,7 +472,6 @@ const is_debug = debug;
* @param {*} data
*/
const log = (data, type) => {
let msg_type = '';
switch (data.lt) {
case '1':
......@@ -498,7 +497,7 @@ const log = (data, type) => {
// #ifdef APP
// 在 app 中,日志转为 字符串
if(typeof data === 'object') {
if (typeof data === 'object') {
data = JSON.stringify(data);
}
// #endif
......@@ -530,6 +529,17 @@ const get_report_Interval = (defaultTime) => {
// 如果不是整数,则默认为上报间隔时间
if (!reg.test(time)) return defaultTime
return Number(time)
};
/**
* 获取隐私协议配置
*/
const is_push_clientid = () => {
if (uniStatisticsConfig.collectItems) {
const ClientID = uniStatisticsConfig.collectItems.uniPushClientID;
return typeof ClientID === 'boolean' ? ClientID : false
}
return false
};
const appid = process.env.UNI_APP_ID; // 做应用隔离
......@@ -1302,7 +1312,8 @@ class Stat extends Report {
* 获取推送id
*/
pushEvent(options) {
if (uni.getPushClientId) {
const ClientID = is_push_clientid();
if (uni.getPushClientId && ClientID) {
uni.getPushClientId({
success: (res) => {
const cid = res.cid || false;
......
......@@ -453,7 +453,6 @@ const is_debug = debug;
* @param {*} data
*/
const log = (data, type) => {
let msg_type = '';
switch (data.lt) {
case '1':
......@@ -479,7 +478,7 @@ const log = (data, type) => {
// #ifdef APP
// 在 app 中,日志转为 字符串
if(typeof data === 'object') {
if (typeof data === 'object') {
data = JSON.stringify(data);
}
// #endif
......@@ -511,6 +510,17 @@ const get_report_Interval = (defaultTime) => {
// 如果不是整数,则默认为上报间隔时间
if (!reg.test(time)) return defaultTime
return Number(time)
};
/**
* 获取隐私协议配置
*/
const is_push_clientid = () => {
if (uniStatisticsConfig.collectItems) {
const ClientID = uniStatisticsConfig.collectItems.uniPushClientID;
return typeof ClientID === 'boolean' ? ClientID : false
}
return false
};
const appid = process.env.UNI_APP_ID; // 做应用隔离
......@@ -1268,7 +1278,8 @@ class Stat extends Report {
* 获取推送id
*/
pushEvent(options) {
if (uni.getPushClientId) {
const ClientID = is_push_clientid();
if (uni.getPushClientId && ClientID) {
uni.getPushClientId({
success: (res) => {
const cid = res.cid || false;
......
......@@ -451,7 +451,6 @@ const is_debug = debug;
* @param {*} data
*/
const log = (data, type) => {
let msg_type = '';
switch (data.lt) {
case '1':
......@@ -477,7 +476,7 @@ const log = (data, type) => {
// #ifdef APP
// 在 app 中,日志转为 字符串
if(typeof data === 'object') {
if (typeof data === 'object') {
data = JSON.stringify(data);
}
// #endif
......@@ -509,6 +508,17 @@ const get_report_Interval = (defaultTime) => {
// 如果不是整数,则默认为上报间隔时间
if (!reg.test(time)) return defaultTime
return Number(time)
};
/**
* 获取隐私协议配置
*/
const is_push_clientid = () => {
if (uniStatisticsConfig.collectItems) {
const ClientID = uniStatisticsConfig.collectItems.uniPushClientID;
return typeof ClientID === 'boolean' ? ClientID : false
}
return false
};
const appid = process.env.UNI_APP_ID; // 做应用隔离
......@@ -1266,7 +1276,8 @@ class Stat extends Report {
* 获取推送id
*/
pushEvent(options) {
if (uni.getPushClientId) {
const ClientID = is_push_clientid();
if (uni.getPushClientId && ClientID) {
uni.getPushClientId({
success: (res) => {
const cid = res.cid || false;
......
......@@ -6,6 +6,7 @@ import {
get_platform_name,
get_space,
is_debug,
is_push_clientid
} from '../utils/pageInfo.js'
import { dbSet } from '../utils/db.js'
class Stat extends Report {
......@@ -51,7 +52,8 @@ class Stat extends Report {
* 获取推送id
*/
pushEvent(options) {
if (uni.getPushClientId) {
const ClientID = is_push_clientid()
if (uni.getPushClientId && ClientID) {
uni.getPushClientId({
success: (res) => {
const cid = res.cid || false
......
......@@ -481,7 +481,6 @@ export const is_debug = debug
* @param {*} data
*/
export const log = (data, type) => {
let msg_type = ''
switch (data.lt) {
case '1':
......@@ -507,7 +506,7 @@ export const log = (data, type) => {
// #ifdef APP
// 在 app 中,日志转为 字符串
if(typeof data === 'object') {
if (typeof data === 'object') {
data = JSON.stringify(data)
}
// #endif
......@@ -540,3 +539,14 @@ export const get_report_Interval = (defaultTime) => {
if (!reg.test(time)) return defaultTime
return Number(time)
}
/**
* 获取隐私协议配置
*/
export const is_push_clientid = () => {
if (uniStatisticsConfig.collectItems) {
const ClientID = uniStatisticsConfig.collectItems.uniPushClientID
return typeof ClientID === 'boolean' ? ClientID : false
}
return false
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册