@tmsfe/tms-core 0.0.37 → 0.0.40
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/report/formatV1.ts +2 -1
- package/src/report/helper.ts +0 -6
- package/src/report/sender.ts +2 -2
- package/src/report/types.ts +3 -3
package/package.json
CHANGED
package/src/report/formatV1.ts
CHANGED
|
@@ -12,6 +12,7 @@ function getBaseData(deviceData: IDeviceData): DataItem[] {
|
|
|
12
12
|
const arr = new Array<string>(helper.dataArrLen);
|
|
13
13
|
const { networkType, location } = deviceData;
|
|
14
14
|
const { appVersion, client } = helper.getInitOptions();
|
|
15
|
+
const { host } = helper.getSystemInfo();
|
|
15
16
|
// todo: 如何区分新旧埋点?新:f20不为空,旧:f20为空
|
|
16
17
|
// ++++++++++++++++++++++++++字段列表++++++++++++++++++++++++++
|
|
17
18
|
// 0: log_time,日志入库时间
|
|
@@ -42,7 +43,7 @@ function getBaseData(deviceData: IDeviceData): DataItem[] {
|
|
|
42
43
|
// 18: f18,city - 城市
|
|
43
44
|
arr[18] = location.cityName;
|
|
44
45
|
// 19: f19,当前小程序运行的宿主环境
|
|
45
|
-
arr[19] = helper.
|
|
46
|
+
arr[19] = helper.convert2String(host);
|
|
46
47
|
// 28: f28,sinan、mycar等
|
|
47
48
|
arr[28] = client;
|
|
48
49
|
// 29: f29,小程序场景值
|
package/src/report/helper.ts
CHANGED
|
@@ -117,11 +117,6 @@ function getAppScene(): string {
|
|
|
117
117
|
return scene.toString();
|
|
118
118
|
}
|
|
119
119
|
|
|
120
|
-
// 给非空字段都encodeURIComponent一下
|
|
121
|
-
function encodeItems(arr: DataItem[]): DataItem[] {
|
|
122
|
-
return arr.map(t => (t ? encodeURIComponent(t) : t));
|
|
123
|
-
}
|
|
124
|
-
|
|
125
120
|
// 是否爬虫
|
|
126
121
|
let isCrawler: boolean | null = null;
|
|
127
122
|
|
|
@@ -207,7 +202,6 @@ function getDeviceData(): Promise<IDeviceData> {
|
|
|
207
202
|
export default {
|
|
208
203
|
init,
|
|
209
204
|
getTms,
|
|
210
|
-
encodeItems,
|
|
211
205
|
getInitOptions,
|
|
212
206
|
getSystemInfo,
|
|
213
207
|
getSystemInfoString,
|
package/src/report/sender.ts
CHANGED
|
@@ -73,7 +73,7 @@ function requestFail(batch: DataItem[][]): void {
|
|
|
73
73
|
*/
|
|
74
74
|
function send(arr: DataItem[]): void {
|
|
75
75
|
stopTimer();
|
|
76
|
-
cacheArr.unshift(
|
|
76
|
+
cacheArr.unshift(arr); // 如果队列中很多,排前面比较稳妥
|
|
77
77
|
batchSendData();
|
|
78
78
|
}
|
|
79
79
|
|
|
@@ -82,7 +82,7 @@ function send(arr: DataItem[]): void {
|
|
|
82
82
|
* @param arr
|
|
83
83
|
*/
|
|
84
84
|
function queue(arr: DataItem[]): void {
|
|
85
|
-
cacheArr.push(
|
|
85
|
+
cacheArr.push(arr);
|
|
86
86
|
checkQueue(false);
|
|
87
87
|
}
|
|
88
88
|
|
package/src/report/types.ts
CHANGED