visual-buried-point-platform-uni 1.0.0-alpha.4 → 1.0.0-alpha.5

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.
Files changed (3) hide show
  1. package/index.js +12 -8
  2. package/package.json +2 -2
  3. package/tools.js +17 -19
package/index.js CHANGED
@@ -29,6 +29,8 @@ let _config = {
29
29
  srcDomain: "",
30
30
  flushInterval: 15,
31
31
  };
32
+ //custom
33
+ let timer = null;
32
34
  //track upload interval
33
35
  let tInterval = null;
34
36
  let busObj = null;
@@ -127,18 +129,20 @@ export function setCustomEvent(data) {
127
129
  };
128
130
  if (reportData) {
129
131
  addCache(reportData);
130
- const data = getCache();
131
- if (data.length) {
132
- console.log("customData: ", JSON.stringify(data));
133
- addSData(data);
134
- clearCache();
135
- }
132
+ clearTimeout(timer);
133
+ timer = setTimeout(() => {
134
+ const data = getCache();
135
+ if (data.length) {
136
+ addSData(data);
137
+ clearCache();
138
+ }
139
+ }, 1000);
136
140
  }
137
141
  }
138
142
 
139
143
  function reportCustom(data) {
140
144
  if (!reportUrl) {
141
- //console.error("please set upload data url");
145
+ console.error("please set upload data reportUrl");
142
146
  return;
143
147
  }
144
148
  const comData = commonData(data);
@@ -259,7 +263,7 @@ function commonData(allData) {
259
263
  return {
260
264
  app: appData,
261
265
  data: allData,
262
- deviceData: deviceData,
266
+ device: deviceData,
263
267
  lsi: localLsi,
264
268
  projectId: _config.token,
265
269
  userAgent: uAgent ? uAgent : "",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "visual-buried-point-platform-uni",
3
- "version": "1.0.0-alpha.04",
4
- "lsi": "278a70bc53ca1fad0e680e2aa1fe2855",
3
+ "version": "1.0.0-alpha.05",
4
+ "lsi": "50ba3c2ac38fa587d3ff435ae1a0fb21",
5
5
  "description": "To make it easy for you to get started with GitLab, here's a list of recommended next steps.",
6
6
  "main": "index.js",
7
7
  "scripts": {
package/tools.js CHANGED
@@ -65,10 +65,13 @@ export function webH5Info(result) {
65
65
  //微信的appInfo
66
66
  export function wxInfo() {
67
67
  let accInfo = uni.getAccountInfoSync();
68
+ console.log("baseinfo " + JSON.stringify(uni.getAppBaseInfo()));
68
69
  return {
69
70
  name: "",
70
- packageName: accInfo ? accInfo.appId : "",
71
- version: accInfo ? accInfo.envVersion + accInfo.version : "",
71
+ packageName: accInfo ? accInfo.miniProgram.appId : "",
72
+ version: accInfo
73
+ ? accInfo.miniProgram.envVersion + accInfo.miniProgram.version
74
+ : "",
72
75
  carrier: "mini",
73
76
  ecology: "wechat",
74
77
  };
@@ -81,6 +84,8 @@ export function getAppInfo(result) {
81
84
  name: result.appName,
82
85
  version: version ? version : "",
83
86
  carrier: "app",
87
+ packageName: "",
88
+ ecology: "",
84
89
  };
85
90
  if (result.platform === "android") {
86
91
  let osName = "android";
@@ -88,28 +93,17 @@ export function getAppInfo(result) {
88
93
  if (result.romName.includes("HarmonyOS")) {
89
94
  osName = "harmonyOS";
90
95
  }
91
- app = {
92
- ...app,
93
- packageName: pkName ? pkName : "",
94
- ecology: osName,
95
- };
96
+ app.packageName = pkName ? pkName : "";
97
+ app.ecology = osName;
96
98
  } else if (result.platform === "ios") {
97
99
  let pkName = plus.ios
98
100
  .importClass("NSBundle")
99
101
  .mainBundle()
100
102
  .bundleIdentifier();
101
- app = {
102
- ...app,
103
- packageName: pkName ? pkName : "",
104
- ecology: "ios",
105
- };
103
+ app.packageName = pkName ? pkName : "";
104
+ app.ecology = "ios";
106
105
  } else {
107
- app = {
108
- ...app,
109
- packageName: "",
110
- version: "",
111
- ecology: "unknown",
112
- };
106
+ app.ecology = "unknown";
113
107
  }
114
108
  return app;
115
109
  }
@@ -127,7 +121,11 @@ function getCurDeviceType(res, platform) {
127
121
  return 2;
128
122
  }
129
123
  } else {
130
- return 1;
124
+ if (res.deviceType === "pc") {
125
+ return 2;
126
+ } else {
127
+ return 1;
128
+ }
131
129
  }
132
130
  }
133
131