yas-report.js
1.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import dataUtils from './data-utils.js';
import api from './api.js';
export const yasReport = async function (eventId = '', data = {}, app) {
let systemInfo = dataUtils.getGlobalDataByKey('systemInfo');
let dm = systemInfo.model; //设备型号
let ln = systemInfo.language;//语言
let os = systemInfo.platform;//系统类型
let osv = systemInfo.system;//系统版本
let re = systemInfo.screenWidth + '*' + systemInfo.screenHeight;//屏幕大小
let net = await dataUtils.getNetworkType() || '0'
let ak = dataUtils.getConfig().reportParams.ak;
let ts = new Date().getTime() + '';
//用户id
let uid = dataUtils.getUid();
//设备id
let udid = dataUtils.getGlobalDataByKey('udid');
//会话id
let sid = dataUtils.getGlobalDataByKey('sid') || '';
let cid = dataUtils.getConfig().reportParams.cid;
let union_id = dataUtils.getGlobalDataByKey('WXUnion_ID');
let union_type = app.getUnion_type();
let statusParam = { 'net': net, 'ln': ln };
let deviceParam = { 'res': re, 'osv': osv, 'os': os, 'ak': ak, 'dm': dm, 'udid': udid, 'ch': `${union_type}` };
let userParam = data;
userParam.C_ID = cid;
userParam.UNION_ID = union_id;
if (eventId == 'YB_REGISTER_SUCCESS') { // 邀新注册
userParam.UNION_TYPE = union_type
let source = dataUtils.getGlobalDataByKey('source')
if (source) {
userParam.source = source
}
dataUtils.setGlobalData('source', '')
}
let eventParam = [{ 'param': userParam, 'ts': ts, 'op': eventId, 'uid': uid, 'sid': sid }]
let parameters = { 'status': statusParam, 'device': deviceParam, 'events': eventParam }
api.uploadLog(parameters)
}