Skip to content

Commit

Permalink
feat(stat): create session type ==> cst
Browse files Browse the repository at this point in the history
  • Loading branch information
mehaotian committed May 23, 2022
1 parent 021cd83 commit d9c4ee4
Show file tree
Hide file tree
Showing 4 changed files with 74 additions and 42 deletions.
47 changes: 29 additions & 18 deletions packages/uni-stat/dist/uni-cloud-stat.cjs.js
Original file line number Diff line number Diff line change
Expand Up @@ -814,6 +814,7 @@ class Report {
let options = {
path: lastPageRoute,
scene: this.statData.sc,
cst: 2,
};
this.sendReportRequest(options);
}
Expand Down Expand Up @@ -880,6 +881,7 @@ class Report {
let options = {
path: route,
scene: this.statData.sc,
cst: 3,
};
this.sendReportRequest(options);
}
Expand Down Expand Up @@ -926,6 +928,8 @@ class Report {
fvts: get_first_visit_time(),
lvts: get_last_visit_time(),
tvc: get_total_visit_count(),
// create session type 上报类型 ,1 应用进入 2.后台30min进入 3.页面30min进入
cst: options.cst || 1,
});
if (get_platform_name() === 'n') {
this.getProperty();
Expand Down Expand Up @@ -984,16 +988,15 @@ class Report {
* 自定义事件上报
*/
sendEventRequest({ key = '', value = '' } = {}) {

let routepath = '';

try {
routepath = get_route$1();
} catch (error) {
const launch_options = dbGet('__launch_options');
routepath = launch_options.path;
routepath = launch_options.path;
}

this._navigationBarTitle.config = get_page_name(routepath);
this._navigationBarTitle.lt = '21';
let options = {
Expand Down Expand Up @@ -1129,21 +1132,27 @@ class Report {
return
}

const uniCloudObj = uni.__stat_uniCloud_space.importObject('uni-stat-receiver', {
customUI: true
});
uniCloudObj.report(optionsData).then(() => {
if (is_debug) {
console.log(`=== 统计队列数据上报 ===`);
console.log(optionsData);
console.log(`=== 上报结束 ===`);
}
}).catch((err) => {
if (is_debug) {
console.warn('=== 统计上报错误');
console.error(err);
}
});
const uniCloudObj = uni.__stat_uniCloud_space.importObject(
'uni-stat-receiver',
{
customUI: true,
}
);
uniCloudObj
.report(optionsData)
.then(() => {
if (is_debug) {
console.log(`=== 统计队列数据上报 ===`);
console.log(optionsData);
console.log(`=== 上报结束 ===`);
}
})
.catch((err) => {
if (is_debug) {
console.warn('=== 统计上报错误');
console.error(err);
}
});
}
}

Expand Down Expand Up @@ -1228,6 +1237,8 @@ class Stat extends Report {
set_page_residence_time();
this.__licationShow = true;
dbSet('__launch_options', options);
// 应用初始上报参数为1
options.cst = 1;
this.sendReportRequest(options, true);
}
load(options, self) {
Expand Down
47 changes: 29 additions & 18 deletions packages/uni-stat/dist/uni-cloud-stat.es.js
Original file line number Diff line number Diff line change
Expand Up @@ -812,6 +812,7 @@ class Report {
let options = {
path: lastPageRoute,
scene: this.statData.sc,
cst: 2,
};
this.sendReportRequest(options);
}
Expand Down Expand Up @@ -878,6 +879,7 @@ class Report {
let options = {
path: route,
scene: this.statData.sc,
cst: 3,
};
this.sendReportRequest(options);
}
Expand Down Expand Up @@ -924,6 +926,8 @@ class Report {
fvts: get_first_visit_time(),
lvts: get_last_visit_time(),
tvc: get_total_visit_count(),
// create session type 上报类型 ,1 应用进入 2.后台30min进入 3.页面30min进入
cst: options.cst || 1,
});
if (get_platform_name() === 'n') {
this.getProperty();
Expand Down Expand Up @@ -982,16 +986,15 @@ class Report {
* 自定义事件上报
*/
sendEventRequest({ key = '', value = '' } = {}) {

let routepath = '';

try {
routepath = get_route$1();
} catch (error) {
const launch_options = dbGet('__launch_options');
routepath = launch_options.path;
routepath = launch_options.path;
}

this._navigationBarTitle.config = get_page_name(routepath);
this._navigationBarTitle.lt = '21';
let options = {
Expand Down Expand Up @@ -1127,21 +1130,27 @@ class Report {
return
}

const uniCloudObj = uni.__stat_uniCloud_space.importObject('uni-stat-receiver', {
customUI: true
});
uniCloudObj.report(optionsData).then(() => {
if (is_debug) {
console.log(`=== 统计队列数据上报 ===`);
console.log(optionsData);
console.log(`=== 上报结束 ===`);
}
}).catch((err) => {
if (is_debug) {
console.warn('=== 统计上报错误');
console.error(err);
}
});
const uniCloudObj = uni.__stat_uniCloud_space.importObject(
'uni-stat-receiver',
{
customUI: true,
}
);
uniCloudObj
.report(optionsData)
.then(() => {
if (is_debug) {
console.log(`=== 统计队列数据上报 ===`);
console.log(optionsData);
console.log(`=== 上报结束 ===`);
}
})
.catch((err) => {
if (is_debug) {
console.warn('=== 统计上报错误');
console.error(err);
}
});
}
}

Expand Down Expand Up @@ -1226,6 +1235,8 @@ class Stat extends Report {
set_page_residence_time();
this.__licationShow = true;
dbSet('__launch_options', options);
// 应用初始上报参数为1
options.cst = 1;
this.sendReportRequest(options, true);
}
load(options, self) {
Expand Down
11 changes: 8 additions & 3 deletions packages/uni-stat/dist/uni-stat.cjs.js
Original file line number Diff line number Diff line change
Expand Up @@ -793,6 +793,7 @@ class Report {
let options = {
path: lastPageRoute,
scene: this.statData.sc,
cst: 2,
};
this.sendReportRequest(options);
}
Expand Down Expand Up @@ -859,6 +860,7 @@ class Report {
let options = {
path: route,
scene: this.statData.sc,
cst: 3,
};
this.sendReportRequest(options);
}
Expand Down Expand Up @@ -905,6 +907,8 @@ class Report {
fvts: get_first_visit_time(),
lvts: get_last_visit_time(),
tvc: get_total_visit_count(),
// create session type 上报类型 ,1 应用进入 2.后台30min进入 3.页面30min进入
cst: options.cst || 1,
});
if (get_platform_name() === 'n') {
this.getProperty();
Expand Down Expand Up @@ -963,16 +967,15 @@ class Report {
* 自定义事件上报
*/
sendEventRequest({ key = '', value = '' } = {}) {

let routepath = '';

try {
routepath = get_route$1();
} catch (error) {
const launch_options = dbGet('__launch_options');
routepath = launch_options.path;
routepath = launch_options.path;
}

this._navigationBarTitle.config = get_page_name(routepath);
this._navigationBarTitle.lt = '21';
let options = {
Expand Down Expand Up @@ -1195,6 +1198,8 @@ class Stat extends Report {
set_page_residence_time();
this.__licationShow = true;
dbSet('__launch_options', options);
// 应用初始上报参数为1
options.cst = 1;
this.sendReportRequest(options, true);
}
load(options, self) {
Expand Down
11 changes: 8 additions & 3 deletions packages/uni-stat/dist/uni-stat.es.js
Original file line number Diff line number Diff line change
Expand Up @@ -791,6 +791,7 @@ class Report {
let options = {
path: lastPageRoute,
scene: this.statData.sc,
cst: 2,
};
this.sendReportRequest(options);
}
Expand Down Expand Up @@ -857,6 +858,7 @@ class Report {
let options = {
path: route,
scene: this.statData.sc,
cst: 3,
};
this.sendReportRequest(options);
}
Expand Down Expand Up @@ -903,6 +905,8 @@ class Report {
fvts: get_first_visit_time(),
lvts: get_last_visit_time(),
tvc: get_total_visit_count(),
// create session type 上报类型 ,1 应用进入 2.后台30min进入 3.页面30min进入
cst: options.cst || 1,
});
if (get_platform_name() === 'n') {
this.getProperty();
Expand Down Expand Up @@ -961,16 +965,15 @@ class Report {
* 自定义事件上报
*/
sendEventRequest({ key = '', value = '' } = {}) {

let routepath = '';

try {
routepath = get_route$1();
} catch (error) {
const launch_options = dbGet('__launch_options');
routepath = launch_options.path;
routepath = launch_options.path;
}

this._navigationBarTitle.config = get_page_name(routepath);
this._navigationBarTitle.lt = '21';
let options = {
Expand Down Expand Up @@ -1193,6 +1196,8 @@ class Stat extends Report {
set_page_residence_time();
this.__licationShow = true;
dbSet('__launch_options', options);
// 应用初始上报参数为1
options.cst = 1;
this.sendReportRequest(options, true);
}
load(options, self) {
Expand Down

0 comments on commit d9c4ee4

Please sign in to comment.