@tmsfe/tms-core 0.0.113 → 0.0.115

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.113",
3
+ "version": "0.0.115",
4
4
  "description": "tms运行时框架",
5
5
  "repository": {
6
6
  "type": "git",
package/src/request.js CHANGED
@@ -22,7 +22,7 @@ const logger = wx.getLogManager({});
22
22
  */
23
23
  const seriesParam = (param) => {
24
24
  const keys = Object.keys(param)
25
- .sort();
25
+ .sort();
26
26
  const series = keys.map((key) => {
27
27
  const val = param[key];
28
28
  return `${key}${typeof val === 'object' ? JSON.stringify(val) : val}`;
@@ -53,12 +53,12 @@ const composeParam = async (param = {}, withAuth = true, baseParam = {}) => {
53
53
  const version = '1.0';
54
54
  const { appVersion, wxAppId, client } = getEnvInfo();
55
55
  const nonce = Math.random()
56
- .toString(36)
57
- .substr(2, 10);
56
+ .toString(36)
57
+ .substr(2, 10);
58
58
  const timestamp = Date.now();
59
59
  const random = Math.random()
60
- .toString()
61
- .slice(2, 7);
60
+ .toString()
61
+ .slice(2, 7);
62
62
  const sourceId = ['', 'sinan', 'mycar'].indexOf(client) + 7; // 6 未知 7 云函数 8 出行 9 我的车
63
63
  const seqId = `${timestamp}${sourceId}${random}`;
64
64
  const paramsWithAuth = await modifyAuthParam(param, withAuth);
@@ -76,14 +76,14 @@ const composeParam = async (param = {}, withAuth = true, baseParam = {}) => {
76
76
  );
77
77
  // 清理undefined和NaN的参数
78
78
  Object.keys(combinedParam)
79
- .forEach((key) => {
80
- if (typeof combinedParam[key] === 'number' && isNaN(combinedParam[key])) {
81
- delete combinedParam[key];
82
- }
83
- if (typeof combinedParam[key] === 'undefined') {
84
- delete combinedParam[key];
85
- }
86
- });
79
+ .forEach((key) => {
80
+ if (typeof combinedParam[key] === 'number' && isNaN(combinedParam[key])) {
81
+ delete combinedParam[key];
82
+ }
83
+ if (typeof combinedParam[key] === 'undefined') {
84
+ delete combinedParam[key];
85
+ }
86
+ });
87
87
  return combinedParam;
88
88
  };
89
89
 
@@ -312,7 +312,6 @@ export default class Request {
312
312
  const requestParam = await composeParam(param, this.withAuth, this.baseParam);
313
313
  const data = sign(requestParam);
314
314
  return new Promise((resolve, reject) => {
315
-
316
315
  const requestTime = Date.now();
317
316
  const printLog = (isSuccess, res) => {
318
317
  // 埋点已经单独打日志了,接口请求数据日志太长影响分析
@@ -352,6 +351,7 @@ export default class Request {
352
351
  header,
353
352
  method,
354
353
  data,
354
+ enableHttp2: true,
355
355
  success: (res) => {
356
356
  printLog(true, res.data);
357
357
  resolve(res);
@@ -87,7 +87,8 @@ const parseProvinceCode = (loc) => {
87
87
  if (!loc) return '';
88
88
  const { provinceCode, cityCode } = loc;
89
89
  if (provinceCode) return provinceCode;
90
- return cityCode ? cityCode.slice(0, 2).padEnd(6, 0) : '';
90
+ return cityCode ? String(cityCode).slice(0, 2)
91
+ .padEnd(6, 0) : '';
91
92
  };
92
93
 
93
94
  /**