Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
r15132706585
uni-app
提交
49cc4d9f
U
uni-app
项目概览
r15132706585
/
uni-app
与 Fork 源项目一致
Fork自
DCloud / uni-app
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
uni-app
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
49cc4d9f
编写于
7月 06, 2022
作者:
M
mehaotian
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat(stat): 新增首次上报,新增push cid 上报
上级
d1317133
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
314 addition
and
64 deletion
+314
-64
packages/uni-stat/dist/uni-cloud-stat.cjs.js
packages/uni-stat/dist/uni-cloud-stat.cjs.js
+77
-17
packages/uni-stat/dist/uni-cloud-stat.es.js
packages/uni-stat/dist/uni-cloud-stat.es.js
+77
-17
packages/uni-stat/dist/uni-stat.cjs.js
packages/uni-stat/dist/uni-stat.cjs.js
+80
-15
packages/uni-stat/dist/uni-stat.es.js
packages/uni-stat/dist/uni-stat.es.js
+80
-15
未找到文件。
packages/uni-stat/dist/uni-cloud-stat.cjs.js
浏览文件 @
49cc4d9f
...
...
@@ -490,6 +490,9 @@ const log = (data) => {
case
'
31
'
:
msg_type
=
'
应用错误
'
;
break
case
'
101
'
:
msg_type
=
'
PUSH
'
;
break
}
if
(
msg_type
)
{
console
.
log
(
`=== 统计数据采集:
${
msg_type
}
===`
);
...
...
@@ -914,8 +917,9 @@ class Report {
/**
* 发送请求,应用维度上报
* @param {Object} options 页面信息
* @param {Boolean} type 是否立即上报
*/
sendReportRequest
(
options
)
{
sendReportRequest
(
options
,
type
)
{
this
.
_navigationBarTitle
.
lt
=
'
1
'
;
this
.
_navigationBarTitle
.
config
=
get_page_name
(
options
.
path
);
let
is_opt
=
options
.
query
&&
JSON
.
stringify
(
options
.
query
)
!==
'
{}
'
;
...
...
@@ -932,9 +936,9 @@ class Report {
cst
:
options
.
cst
||
1
,
});
if
(
get_platform_name
()
===
'
n
'
)
{
this
.
getProperty
();
this
.
getProperty
(
type
);
}
else
{
this
.
getNetworkInfo
();
this
.
getNetworkInfo
(
type
);
}
}
...
...
@@ -1015,24 +1019,59 @@ class Report {
this
.
request
(
options
);
}
sendPushRequest
(
options
,
cid
)
{
let
time
=
get_time
();
const
statData
=
{
lt
:
'
101
'
,
cid
:
cid
,
t
:
time
,
ut
:
this
.
statData
.
ut
,
};
// debug 打印打点信息
if
(
is_debug
)
{
log
(
statData
);
}
const
stat_data
=
handle_data
({
101
:
[
statData
],
});
let
optionsData
=
{
usv
:
STAT_VERSION
,
//统计 SDK 版本号
t
:
time
,
//发送请求时的时间戮
requests
:
stat_data
,
};
// XXX 安卓需要延迟上报 ,否则会有未知错误,需要验证处理
if
(
get_platform_name
()
===
'
n
'
&&
this
.
statData
.
p
===
'
a
'
)
{
setTimeout
(()
=>
{
this
.
sendRequest
(
optionsData
);
},
200
);
return
}
this
.
sendRequest
(
optionsData
);
}
/**
* 获取wgt资源版本
*/
getProperty
()
{
getProperty
(
type
)
{
plus
.
runtime
.
getProperty
(
plus
.
runtime
.
appid
,
(
wgtinfo
)
=>
{
this
.
statData
.
v
=
wgtinfo
.
version
||
''
;
this
.
getNetworkInfo
();
this
.
getNetworkInfo
(
type
);
});
}
/**
* 获取网络信息
*/
getNetworkInfo
()
{
getNetworkInfo
(
type
)
{
uni
.
getNetworkType
({
success
:
(
result
)
=>
{
this
.
statData
.
net
=
result
.
networkType
;
this
.
getLocation
();
this
.
getLocation
(
type
);
},
});
}
...
...
@@ -1040,7 +1079,7 @@ class Report {
/**
* 获取位置信息
*/
getLocation
()
{
getLocation
(
type
)
{
if
(
stat_config
.
getLocation
)
{
uni
.
getLocation
({
type
:
'
wgs84
'
,
...
...
@@ -1054,13 +1093,13 @@ class Report {
this
.
statData
.
lat
=
result
.
latitude
;
this
.
statData
.
lng
=
result
.
longitude
;
this
.
request
(
this
.
statData
);
this
.
request
(
this
.
statData
,
type
);
},
});
}
else
{
this
.
statData
.
lat
=
0
;
this
.
statData
.
lng
=
0
;
this
.
request
(
this
.
statData
);
this
.
request
(
this
.
statData
,
type
);
}
}
...
...
@@ -1205,9 +1244,9 @@ class Stat extends Report {
let
spaceData
=
{
provider
:
space
.
provider
,
spaceId
:
space
.
spaceId
,
clientSecret
:
space
.
clientSecret
clientSecret
:
space
.
clientSecret
,
};
if
(
space
.
endpoint
)
{
if
(
space
.
endpoint
)
{
spaceData
.
endpoint
=
space
.
endpoint
;
}
uni
.
__stat_uniCloud_space
=
uniCloud
.
init
(
spaceData
);
...
...
@@ -1216,7 +1255,9 @@ class Stat extends Report {
// uni.__stat_uniCloud_space.config.spaceId
// )
}
else
{
console
.
error
(
'
当前尚未关联统计服务空间,请先在manifest.json中配置服务空间!
'
);
console
.
error
(
'
当前尚未关联统计服务空间,请先在manifest.json中配置服务空间!
'
);
}
}
}
...
...
@@ -1227,6 +1268,23 @@ class Stat extends Report {
super
();
}
/**
* 获取推送id
*/
pushEvent
(
options
)
{
if
(
uni
.
getPushClientId
)
{
uni
.
getPushClientId
({
success
:
(
res
)
=>
{
const
cid
=
res
.
cid
||
false
;
// 只有获取到才会上传
if
(
cid
)
{
this
.
sendPushRequest
(
options
,
cid
);
}
},
});
}
}
/**
* 进入应用
* @param {Object} options 页面参数
...
...
@@ -1237,7 +1295,7 @@ class Stat extends Report {
set_page_residence_time
();
this
.
__licationShow
=
true
;
dbSet
(
'
__launch_options
'
,
options
);
// 应用初始上报参数为1
// 应用初始上报参数为1
options
.
cst
=
1
;
this
.
sendReportRequest
(
options
,
true
);
}
...
...
@@ -1313,8 +1371,8 @@ class Stat extends Report {
let
route
=
''
;
try
{
route
=
get_route
();
}
catch
(
e
)
{
route
=
get_route
();
}
catch
(
e
)
{
// 未获取到页面路径
route
=
''
;
}
...
...
@@ -1324,7 +1382,7 @@ class Stat extends Report {
uuid
:
this
.
statData
.
uuid
,
p
:
this
.
statData
.
p
,
lt
:
'
31
'
,
url
:
route
,
url
:
route
,
ut
:
this
.
statData
.
ut
,
ch
:
this
.
statData
.
ch
,
mpsdk
:
this
.
statData
.
mpsdk
,
...
...
@@ -1348,6 +1406,8 @@ const lifecycle = {
onLaunch
(
options
)
{
// 进入应用上报数据
stat
.
launch
(
options
,
this
);
// 上报push推送id
stat
.
pushEvent
(
options
);
},
onLoad
(
options
)
{
stat
.
load
(
options
,
this
);
...
...
packages/uni-stat/dist/uni-cloud-stat.es.js
浏览文件 @
49cc4d9f
...
...
@@ -488,6 +488,9 @@ const log = (data) => {
case
'
31
'
:
msg_type
=
'
应用错误
'
;
break
case
'
101
'
:
msg_type
=
'
PUSH
'
;
break
}
if
(
msg_type
)
{
console
.
log
(
`=== 统计数据采集:
${
msg_type
}
===`
);
...
...
@@ -912,8 +915,9 @@ class Report {
/**
* 发送请求,应用维度上报
* @param {Object} options 页面信息
* @param {Boolean} type 是否立即上报
*/
sendReportRequest
(
options
)
{
sendReportRequest
(
options
,
type
)
{
this
.
_navigationBarTitle
.
lt
=
'
1
'
;
this
.
_navigationBarTitle
.
config
=
get_page_name
(
options
.
path
);
let
is_opt
=
options
.
query
&&
JSON
.
stringify
(
options
.
query
)
!==
'
{}
'
;
...
...
@@ -930,9 +934,9 @@ class Report {
cst
:
options
.
cst
||
1
,
});
if
(
get_platform_name
()
===
'
n
'
)
{
this
.
getProperty
();
this
.
getProperty
(
type
);
}
else
{
this
.
getNetworkInfo
();
this
.
getNetworkInfo
(
type
);
}
}
...
...
@@ -1013,24 +1017,59 @@ class Report {
this
.
request
(
options
);
}
sendPushRequest
(
options
,
cid
)
{
let
time
=
get_time
();
const
statData
=
{
lt
:
'
101
'
,
cid
:
cid
,
t
:
time
,
ut
:
this
.
statData
.
ut
,
};
// debug 打印打点信息
if
(
is_debug
)
{
log
(
statData
);
}
const
stat_data
=
handle_data
({
101
:
[
statData
],
});
let
optionsData
=
{
usv
:
STAT_VERSION
,
//统计 SDK 版本号
t
:
time
,
//发送请求时的时间戮
requests
:
stat_data
,
};
// XXX 安卓需要延迟上报 ,否则会有未知错误,需要验证处理
if
(
get_platform_name
()
===
'
n
'
&&
this
.
statData
.
p
===
'
a
'
)
{
setTimeout
(()
=>
{
this
.
sendRequest
(
optionsData
);
},
200
);
return
}
this
.
sendRequest
(
optionsData
);
}
/**
* 获取wgt资源版本
*/
getProperty
()
{
getProperty
(
type
)
{
plus
.
runtime
.
getProperty
(
plus
.
runtime
.
appid
,
(
wgtinfo
)
=>
{
this
.
statData
.
v
=
wgtinfo
.
version
||
''
;
this
.
getNetworkInfo
();
this
.
getNetworkInfo
(
type
);
});
}
/**
* 获取网络信息
*/
getNetworkInfo
()
{
getNetworkInfo
(
type
)
{
uni
.
getNetworkType
({
success
:
(
result
)
=>
{
this
.
statData
.
net
=
result
.
networkType
;
this
.
getLocation
();
this
.
getLocation
(
type
);
},
});
}
...
...
@@ -1038,7 +1077,7 @@ class Report {
/**
* 获取位置信息
*/
getLocation
()
{
getLocation
(
type
)
{
if
(
stat_config
.
getLocation
)
{
uni
.
getLocation
({
type
:
'
wgs84
'
,
...
...
@@ -1052,13 +1091,13 @@ class Report {
this
.
statData
.
lat
=
result
.
latitude
;
this
.
statData
.
lng
=
result
.
longitude
;
this
.
request
(
this
.
statData
);
this
.
request
(
this
.
statData
,
type
);
},
});
}
else
{
this
.
statData
.
lat
=
0
;
this
.
statData
.
lng
=
0
;
this
.
request
(
this
.
statData
);
this
.
request
(
this
.
statData
,
type
);
}
}
...
...
@@ -1203,9 +1242,9 @@ class Stat extends Report {
let
spaceData
=
{
provider
:
space
.
provider
,
spaceId
:
space
.
spaceId
,
clientSecret
:
space
.
clientSecret
clientSecret
:
space
.
clientSecret
,
};
if
(
space
.
endpoint
)
{
if
(
space
.
endpoint
)
{
spaceData
.
endpoint
=
space
.
endpoint
;
}
uni
.
__stat_uniCloud_space
=
uniCloud
.
init
(
spaceData
);
...
...
@@ -1214,7 +1253,9 @@ class Stat extends Report {
// uni.__stat_uniCloud_space.config.spaceId
// )
}
else
{
console
.
error
(
'
当前尚未关联统计服务空间,请先在manifest.json中配置服务空间!
'
);
console
.
error
(
'
当前尚未关联统计服务空间,请先在manifest.json中配置服务空间!
'
);
}
}
}
...
...
@@ -1225,6 +1266,23 @@ class Stat extends Report {
super
();
}
/**
* 获取推送id
*/
pushEvent
(
options
)
{
if
(
uni
.
getPushClientId
)
{
uni
.
getPushClientId
({
success
:
(
res
)
=>
{
const
cid
=
res
.
cid
||
false
;
// 只有获取到才会上传
if
(
cid
)
{
this
.
sendPushRequest
(
options
,
cid
);
}
},
});
}
}
/**
* 进入应用
* @param {Object} options 页面参数
...
...
@@ -1235,7 +1293,7 @@ class Stat extends Report {
set_page_residence_time
();
this
.
__licationShow
=
true
;
dbSet
(
'
__launch_options
'
,
options
);
// 应用初始上报参数为1
// 应用初始上报参数为1
options
.
cst
=
1
;
this
.
sendReportRequest
(
options
,
true
);
}
...
...
@@ -1311,8 +1369,8 @@ class Stat extends Report {
let
route
=
''
;
try
{
route
=
get_route
();
}
catch
(
e
)
{
route
=
get_route
();
}
catch
(
e
)
{
// 未获取到页面路径
route
=
''
;
}
...
...
@@ -1322,7 +1380,7 @@ class Stat extends Report {
uuid
:
this
.
statData
.
uuid
,
p
:
this
.
statData
.
p
,
lt
:
'
31
'
,
url
:
route
,
url
:
route
,
ut
:
this
.
statData
.
ut
,
ch
:
this
.
statData
.
ch
,
mpsdk
:
this
.
statData
.
mpsdk
,
...
...
@@ -1346,6 +1404,8 @@ const lifecycle = {
onLaunch
(
options
)
{
// 进入应用上报数据
stat
.
launch
(
options
,
this
);
// 上报push推送id
stat
.
pushEvent
(
options
);
},
onLoad
(
options
)
{
stat
.
load
(
options
,
this
);
...
...
packages/uni-stat/dist/uni-stat.cjs.js
浏览文件 @
49cc4d9f
...
...
@@ -292,7 +292,7 @@ const handle_data = (statData) => {
rd
.
forEach
((
elm
)
=>
{
let
newData
=
''
;
{
newData
=
get_splicing
(
elm
);
newData
=
get_splicing
(
elm
);
}
if
(
i
===
0
)
{
firstArr
.
push
(
newData
);
...
...
@@ -469,6 +469,9 @@ const log = (data) => {
case
'
31
'
:
msg_type
=
'
应用错误
'
;
break
case
'
101
'
:
msg_type
=
'
PUSH
'
;
break
}
if
(
msg_type
)
{
console
.
log
(
`=== 统计数据采集:
${
msg_type
}
===`
);
...
...
@@ -893,8 +896,9 @@ class Report {
/**
* 发送请求,应用维度上报
* @param {Object} options 页面信息
* @param {Boolean} type 是否立即上报
*/
sendReportRequest
(
options
)
{
sendReportRequest
(
options
,
type
)
{
this
.
_navigationBarTitle
.
lt
=
'
1
'
;
this
.
_navigationBarTitle
.
config
=
get_page_name
(
options
.
path
);
let
is_opt
=
options
.
query
&&
JSON
.
stringify
(
options
.
query
)
!==
'
{}
'
;
...
...
@@ -911,9 +915,9 @@ class Report {
cst
:
options
.
cst
||
1
,
});
if
(
get_platform_name
()
===
'
n
'
)
{
this
.
getProperty
();
this
.
getProperty
(
type
);
}
else
{
this
.
getNetworkInfo
();
this
.
getNetworkInfo
(
type
);
}
}
...
...
@@ -994,24 +998,66 @@ class Report {
this
.
request
(
options
);
}
sendPushRequest
(
options
,
cid
)
{
let
time
=
get_time
();
const
statData
=
{
lt
:
'
101
'
,
cid
:
cid
,
t
:
time
,
ut
:
this
.
statData
.
ut
,
};
// debug 打印打点信息
if
(
is_debug
)
{
log
(
statData
);
}
const
stat_data
=
handle_data
({
101
:
[
statData
],
});
let
optionsData
=
{
usv
:
STAT_VERSION
,
//统计 SDK 版本号
t
:
time
,
//发送请求时的时间戮
requests
:
stat_data
,
};
{
if
(
statData
.
ut
===
'
h5
'
)
{
this
.
imageRequest
(
optionsData
);
return
}
}
// XXX 安卓需要延迟上报 ,否则会有未知错误,需要验证处理
if
(
get_platform_name
()
===
'
n
'
&&
this
.
statData
.
p
===
'
a
'
)
{
setTimeout
(()
=>
{
this
.
sendRequest
(
optionsData
);
},
200
);
return
}
this
.
sendRequest
(
optionsData
);
}
/**
* 获取wgt资源版本
*/
getProperty
()
{
getProperty
(
type
)
{
plus
.
runtime
.
getProperty
(
plus
.
runtime
.
appid
,
(
wgtinfo
)
=>
{
this
.
statData
.
v
=
wgtinfo
.
version
||
''
;
this
.
getNetworkInfo
();
this
.
getNetworkInfo
(
type
);
});
}
/**
* 获取网络信息
*/
getNetworkInfo
()
{
getNetworkInfo
(
type
)
{
uni
.
getNetworkType
({
success
:
(
result
)
=>
{
this
.
statData
.
net
=
result
.
networkType
;
this
.
getLocation
();
this
.
getLocation
(
type
);
},
});
}
...
...
@@ -1019,7 +1065,7 @@ class Report {
/**
* 获取位置信息
*/
getLocation
()
{
getLocation
(
type
)
{
if
(
stat_config
.
getLocation
)
{
uni
.
getLocation
({
type
:
'
wgs84
'
,
...
...
@@ -1033,13 +1079,13 @@ class Report {
this
.
statData
.
lat
=
result
.
latitude
;
this
.
statData
.
lng
=
result
.
longitude
;
this
.
request
(
this
.
statData
);
this
.
request
(
this
.
statData
,
type
);
},
});
}
else
{
this
.
statData
.
lat
=
0
;
this
.
statData
.
lng
=
0
;
this
.
request
(
this
.
statData
);
this
.
request
(
this
.
statData
,
type
);
}
}
...
...
@@ -1188,6 +1234,23 @@ class Stat extends Report {
super
();
}
/**
* 获取推送id
*/
pushEvent
(
options
)
{
if
(
uni
.
getPushClientId
)
{
uni
.
getPushClientId
({
success
:
(
res
)
=>
{
const
cid
=
res
.
cid
||
false
;
// 只有获取到才会上传
if
(
cid
)
{
this
.
sendPushRequest
(
options
,
cid
);
}
},
});
}
}
/**
* 进入应用
* @param {Object} options 页面参数
...
...
@@ -1198,7 +1261,7 @@ class Stat extends Report {
set_page_residence_time
();
this
.
__licationShow
=
true
;
dbSet
(
'
__launch_options
'
,
options
);
// 应用初始上报参数为1
// 应用初始上报参数为1
options
.
cst
=
1
;
this
.
sendReportRequest
(
options
,
true
);
}
...
...
@@ -1274,8 +1337,8 @@ class Stat extends Report {
let
route
=
''
;
try
{
route
=
get_route
();
}
catch
(
e
)
{
route
=
get_route
();
}
catch
(
e
)
{
// 未获取到页面路径
route
=
''
;
}
...
...
@@ -1285,7 +1348,7 @@ class Stat extends Report {
uuid
:
this
.
statData
.
uuid
,
p
:
this
.
statData
.
p
,
lt
:
'
31
'
,
url
:
route
,
url
:
route
,
ut
:
this
.
statData
.
ut
,
ch
:
this
.
statData
.
ch
,
mpsdk
:
this
.
statData
.
mpsdk
,
...
...
@@ -1309,6 +1372,8 @@ const lifecycle = {
onLaunch
(
options
)
{
// 进入应用上报数据
stat
.
launch
(
options
,
this
);
// 上报push推送id
stat
.
pushEvent
(
options
);
},
onLoad
(
options
)
{
stat
.
load
(
options
,
this
);
...
...
packages/uni-stat/dist/uni-stat.es.js
浏览文件 @
49cc4d9f
...
...
@@ -290,7 +290,7 @@ const handle_data = (statData) => {
rd
.
forEach
((
elm
)
=>
{
let
newData
=
''
;
{
newData
=
get_splicing
(
elm
);
newData
=
get_splicing
(
elm
);
}
if
(
i
===
0
)
{
firstArr
.
push
(
newData
);
...
...
@@ -467,6 +467,9 @@ const log = (data) => {
case
'
31
'
:
msg_type
=
'
应用错误
'
;
break
case
'
101
'
:
msg_type
=
'
PUSH
'
;
break
}
if
(
msg_type
)
{
console
.
log
(
`=== 统计数据采集:
${
msg_type
}
===`
);
...
...
@@ -891,8 +894,9 @@ class Report {
/**
* 发送请求,应用维度上报
* @param {Object} options 页面信息
* @param {Boolean} type 是否立即上报
*/
sendReportRequest
(
options
)
{
sendReportRequest
(
options
,
type
)
{
this
.
_navigationBarTitle
.
lt
=
'
1
'
;
this
.
_navigationBarTitle
.
config
=
get_page_name
(
options
.
path
);
let
is_opt
=
options
.
query
&&
JSON
.
stringify
(
options
.
query
)
!==
'
{}
'
;
...
...
@@ -909,9 +913,9 @@ class Report {
cst
:
options
.
cst
||
1
,
});
if
(
get_platform_name
()
===
'
n
'
)
{
this
.
getProperty
();
this
.
getProperty
(
type
);
}
else
{
this
.
getNetworkInfo
();
this
.
getNetworkInfo
(
type
);
}
}
...
...
@@ -992,24 +996,66 @@ class Report {
this
.
request
(
options
);
}
sendPushRequest
(
options
,
cid
)
{
let
time
=
get_time
();
const
statData
=
{
lt
:
'
101
'
,
cid
:
cid
,
t
:
time
,
ut
:
this
.
statData
.
ut
,
};
// debug 打印打点信息
if
(
is_debug
)
{
log
(
statData
);
}
const
stat_data
=
handle_data
({
101
:
[
statData
],
});
let
optionsData
=
{
usv
:
STAT_VERSION
,
//统计 SDK 版本号
t
:
time
,
//发送请求时的时间戮
requests
:
stat_data
,
};
{
if
(
statData
.
ut
===
'
h5
'
)
{
this
.
imageRequest
(
optionsData
);
return
}
}
// XXX 安卓需要延迟上报 ,否则会有未知错误,需要验证处理
if
(
get_platform_name
()
===
'
n
'
&&
this
.
statData
.
p
===
'
a
'
)
{
setTimeout
(()
=>
{
this
.
sendRequest
(
optionsData
);
},
200
);
return
}
this
.
sendRequest
(
optionsData
);
}
/**
* 获取wgt资源版本
*/
getProperty
()
{
getProperty
(
type
)
{
plus
.
runtime
.
getProperty
(
plus
.
runtime
.
appid
,
(
wgtinfo
)
=>
{
this
.
statData
.
v
=
wgtinfo
.
version
||
''
;
this
.
getNetworkInfo
();
this
.
getNetworkInfo
(
type
);
});
}
/**
* 获取网络信息
*/
getNetworkInfo
()
{
getNetworkInfo
(
type
)
{
uni
.
getNetworkType
({
success
:
(
result
)
=>
{
this
.
statData
.
net
=
result
.
networkType
;
this
.
getLocation
();
this
.
getLocation
(
type
);
},
});
}
...
...
@@ -1017,7 +1063,7 @@ class Report {
/**
* 获取位置信息
*/
getLocation
()
{
getLocation
(
type
)
{
if
(
stat_config
.
getLocation
)
{
uni
.
getLocation
({
type
:
'
wgs84
'
,
...
...
@@ -1031,13 +1077,13 @@ class Report {
this
.
statData
.
lat
=
result
.
latitude
;
this
.
statData
.
lng
=
result
.
longitude
;
this
.
request
(
this
.
statData
);
this
.
request
(
this
.
statData
,
type
);
},
});
}
else
{
this
.
statData
.
lat
=
0
;
this
.
statData
.
lng
=
0
;
this
.
request
(
this
.
statData
);
this
.
request
(
this
.
statData
,
type
);
}
}
...
...
@@ -1186,6 +1232,23 @@ class Stat extends Report {
super
();
}
/**
* 获取推送id
*/
pushEvent
(
options
)
{
if
(
uni
.
getPushClientId
)
{
uni
.
getPushClientId
({
success
:
(
res
)
=>
{
const
cid
=
res
.
cid
||
false
;
// 只有获取到才会上传
if
(
cid
)
{
this
.
sendPushRequest
(
options
,
cid
);
}
},
});
}
}
/**
* 进入应用
* @param {Object} options 页面参数
...
...
@@ -1196,7 +1259,7 @@ class Stat extends Report {
set_page_residence_time
();
this
.
__licationShow
=
true
;
dbSet
(
'
__launch_options
'
,
options
);
// 应用初始上报参数为1
// 应用初始上报参数为1
options
.
cst
=
1
;
this
.
sendReportRequest
(
options
,
true
);
}
...
...
@@ -1272,8 +1335,8 @@ class Stat extends Report {
let
route
=
''
;
try
{
route
=
get_route
();
}
catch
(
e
)
{
route
=
get_route
();
}
catch
(
e
)
{
// 未获取到页面路径
route
=
''
;
}
...
...
@@ -1283,7 +1346,7 @@ class Stat extends Report {
uuid
:
this
.
statData
.
uuid
,
p
:
this
.
statData
.
p
,
lt
:
'
31
'
,
url
:
route
,
url
:
route
,
ut
:
this
.
statData
.
ut
,
ch
:
this
.
statData
.
ch
,
mpsdk
:
this
.
statData
.
mpsdk
,
...
...
@@ -1307,6 +1370,8 @@ const lifecycle = {
onLaunch
(
options
)
{
// 进入应用上报数据
stat
.
launch
(
options
,
this
);
// 上报push推送id
stat
.
pushEvent
(
options
);
},
onLoad
(
options
)
{
stat
.
load
(
options
,
this
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录