@tmsfe/tms-core 0.0.44 → 0.0.45

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tmsfe/tms-core",
3
- "version": "0.0.44",
3
+ "version": "0.0.45",
4
4
  "description": "tms运行时框架",
5
5
  "repository": {
6
6
  "type": "git",
@@ -17,7 +17,7 @@ function getBaseData(deviceData: IDeviceData): DataItem[] {
17
17
  // ++++++++++++++++++++++++++字段列表++++++++++++++++++++++++++
18
18
  // 0: log_time,日志入库时间
19
19
  // 1: access_time,埋点触发时间
20
- arr[1] = Date.now().toString();
20
+ arr[1] = helper.getNowString();
21
21
  // 2: user_ip,前端无需赋值
22
22
  // 3: qimei,灯塔中的用户ID
23
23
  // 4: imei,Android手机的imei IOS系统中的idfv 车联网中的wecarid
@@ -17,7 +17,7 @@ function getBaseData(deviceData: IDeviceData): { arr: DataItem[], nextIndex: num
17
17
  // ++++++++++++++++++++++++++字段列表++++++++++++++++++++++++++
18
18
  // 0: log_time,日志入库时间
19
19
  // 1: access_time,埋点触发时间
20
- arr[1] = Date.now().toString();
20
+ arr[1] = helper.getNowString();
21
21
  // 2: user_ip,前端无需赋值
22
22
  // 3: qimei,灯塔中的用户ID
23
23
  // 4: imei,Android手机的imei IOS系统中的idfv 车联网中的wecarid
@@ -83,6 +83,25 @@ function convert2String(value: any): string {
83
83
  return String(value);
84
84
  }
85
85
 
86
+ function num2Str(num: number, maxLength = 2): string {
87
+ return num.toString().padStart(maxLength, '0');
88
+ }
89
+
90
+ /**
91
+ * 获取当前时间格式化后的字符串
92
+ */
93
+ function getNowString(): string {
94
+ const date = new Date();
95
+ const year = date.getFullYear().toString();
96
+ const month = num2Str(date.getMonth() + 1);
97
+ const day = num2Str(date.getDate());
98
+ const hours = num2Str(date.getHours());
99
+ const minutes = num2Str(date.getMinutes());
100
+ const seconds = num2Str(date.getSeconds());
101
+ const ms = num2Str(date.getMilliseconds(), 3);
102
+ return `${year}${month}${day}${hours}${minutes}${seconds}${ms}`;
103
+ }
104
+
86
105
  /**
87
106
  * 获取当前页面信息
88
107
  */
@@ -203,6 +222,7 @@ export default {
203
222
  getSystemInfo,
204
223
  getSystemInfoString,
205
224
  convert2String,
225
+ getNowString,
206
226
  getPageInfo,
207
227
  getLaunchOptionsString,
208
228
  getLaunchFrom,