@conecli/cone-render 0.9.1-shop2.30 → 0.9.1-shop2.31

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.
@@ -1 +1 @@
1
- import React from 'react'
2
1
  return FloorContentItem ? (
3
2
  <ErrorBoundary {...props}>
4
3
  <FloorContentItem {...props} dataDefines={dataDefines} />
5
4
  </ErrorBoundary>
6
5
  ) : isDevMode ? (
7
6
  renderDecorateDefaultModule()
8
7
  ) : null
8
+ import { View } from '@tarojs/components';
9
9
  const { floorData, renderSourceType, builtInComponents = {} } = props;
10
10
  const isDevMode = renderSourceType === BUSINESS_TYPE.DECORATE;
11
11
  const floorModuleType = floorData?.floorExtInfo?.moduleFlag;
12
12
  const FloorContentItem = (floorModuleType && builtInComponents[floorModuleType]) || null;
13
13
  const dataDefines = getFloorDataToDataDefines(floorData);
14
14
 
15
15
  const renderDecorateDefaultModule = () => {
16
16
  return (
17
17
  <View
18
18
  style={{
19
19
  lineHeight: '120px',
20
20
  textAlign: 'center',
21
21
  }}
22
22
  >
23
23
  当前模块是{floorData.moduleName}
24
24
  </View>
25
25
  );
26
26
  };
27
27
  return FloorContentItem ? (
28
28
  <ErrorBoundary {...props}>
29
29
  <FloorContentItem {...props} dataDefines={dataDefines} />
30
30
  </ErrorBoundary>
31
31
  ) : isDevMode ? (
32
32
  renderDecorateDefaultModule()
33
33
  ) : null;
34
34
  renderSourceType: BUSINESS_TYPE.ONLINE,
35
35
  switch (moduleId) {
36
36
  case 83158:
37
37
  return 'freeLayout';
38
38
  case 99654:
39
39
  return 'activeText';
40
40
  case 100382:
41
41
  return 'superGoods';
42
42
  }
43
43
  floorList.map((item) => {
44
44
  if (!item.floorExtInfo) {
45
45
  return null;
46
46
  }
47
47
  const moduleFlag = item.floorExtInfo.moduleFlag;
48
48
  if (!moduleFlag) {
49
49
  const newModuleFlag = moduleId2ModuleFlag(item.moduleId);
50
50
  if (newModuleFlag) {
51
51
  item.floorExtInfo.moduleFlag = newModuleFlag;
52
52
  }
53
53
  }
54
54
  });
@@ -1 +1 @@
1
- import Taro from '@tarojs/taro'
2
1
  isSupportHybridHttpRequest,
3
2
  draInterfaceCustomReport,
4
3
  draBusinessCustomReport,
5
4
  jsonHeader = 'application/json;charset=utf-8',
6
5
  formDataHeader = 'application/x-www-form-urlencoded',
7
6
  HYBRID: 'httpRequest_hybrid',
8
7
  TARO: 'httpRequest_taro',
9
8
  #requestTimeStamp: number
10
9
  #responseTimeStamp: number
11
10
  #getResTimeStamp: number
12
11
  #reportType: string
13
12
  #callbackFunction: string
14
13
 
15
14
  async request({
16
15
  url,
17
16
  method = 'POST',
18
17
  timeout = 7000,
19
18
  isColorVerify = false,
20
19
  ...otherOptions
21
20
  }): Promise<Taro.request.SuccessCallbackResult<any>> {
22
21
  const { header: otherHeader, ...otherOpts } = otherOptions
23
22
  const header = {
24
23
  'content-type':
25
24
  method === 'POST'
26
25
  ? RequestHeaderContentType.formDataHeader
27
26
  : RequestHeaderContentType.jsonHeader,
28
27
  ...otherHeader,
29
28
  }
30
29
  let getRequestUrl = url
31
30
  let requestTask
32
31
  const data = otherOpts?.data
33
32
  const isGatewayRequest =
34
33
  url === this.api.apiFunc && typeof data === 'object'
35
34
  if (isGatewayRequest) {
36
35
  getRequestUrl = this._handleSpecialGatewayUrl(url)
37
36
  const shouldUseHybridRequest = this._shouldUseHybridRequest()
38
37
  if (shouldUseHybridRequest) {
39
38
  requestTask = this._hybridRequest(getRequestUrl, data)
40
39
  } else {
41
40
  otherOpts.data = await this._prepareGatewayReqData(data, isColorVerify)
42
41
  requestTask = this._taroRequest(
43
42
  getRequestUrl,
44
43
  otherOpts,
45
44
  method,
46
45
  timeout,
47
46
  header,
48
47
  )
49
48
  }
50
49
  } else {
51
50
  requestTask = this._taroRequest(
52
51
  getRequestUrl,
53
52
  otherOpts,
54
53
  method,
55
54
  timeout,
56
55
  header,
57
56
  )
58
57
  }
59
58
  const requestTimeoutPromise =
60
59
  new Promise<ServiceInterFace.RequestPromiseRes>((resolve) => {
61
60
  setTimeout(() => {
62
61
  resolve({
63
62
  statusCode: 500,
64
63
  resTimeoutState: true,
65
64
  errMsg: 'request timeout',
66
65
  })
67
66
  }, timeout)
68
67
  })
69
68
  return Promise.race([requestTask, requestTimeoutPromise]).then(
70
69
  (res: any) => {
71
70
  if (res && res.statusCode === 500 && res.resTimeoutState) {
72
71
  if (this.#reportType === HTTP_REQUEST_TYPE.HYBRID) {
73
72
  this._clearFunction(this.#callbackFunction)
74
73
  } else {
75
74
  requestTask.abort && requestTask.abort()
76
75
  }
77
76
  }
78
77
  this._handleReportInterfaceError(url, data, timeout, res)
79
78
  return res
80
79
  },
81
80
  )
82
81
  }
83
82
 
84
83
  _handleSpecialGatewayUrl(url: string): string {
85
84
  if (isPc && window.location.hostname.includes('.jd.hk')) {
86
85
  return this.api.hkApiFunc
87
86
  }
88
87
  if (
89
88
  isJdApp &&
90
89
  window?.shopGlobalSwitch?.dualProtocol &&
91
90
  !window.location.href.includes('jshopx_vconsole')
92
91
  ) {
93
92
  return window?.shopGlobalSwitch?.dualProtocol?.apiTestApp || url
94
93
  }
95
94
  return url
96
95
  }
97
96
 
98
97
  _shouldUseHybridRequest(): boolean {
99
98
  try {
100
99
  if (!isJdApp || !isSupportHybridHttpRequest || isJdAndHarmonyDevice) {
101
100
  return false
102
101
  }
103
102
  const configData = global.getDynamicConfig('hybridHttpSwitch')
104
103
  const { globalOn = false, grayscale = {} } = configData || {}
105
104
  const buildType = process.env.BUILD_TYPE || ''
106
105
  const isInvokeGray = globalOn || grayscale[buildType]
107
106
  console.log(
108
107
  '使用hybrid请求是否命中灰度,isInvokeGray:',
109
108
  isInvokeGray,
110
109
  '获取mpaas配置hybridHttpSwitch原始数据configData',
111
110
  configData,
112
111
  )
113
112
  const hasWindowXWebView = !!window.XWebView
114
113
  return isInvokeGray && hasWindowXWebView
115
114
  } catch (e) {
116
115
  console.log('获取是否使用Hybrid请求出错,e:', e)
117
116
  return false
118
117
  }
119
118
  }
120
119
 
121
120
  _hybridRequest(url: string, data: any): Promise<any> {
122
121
  return new Promise((resolve, reject) => {
123
122
  try {
124
123
  const changeCurrentUrl = url.startsWith('//') ? `https:${url}` : url
125
124
  const { functionId, body, ...otherH5Param } = data
126
125
  const reqParams = {
127
126
  url: isIosDevice ? `${changeCurrentUrl}/` : changeCurrentUrl,
128
127
  functionId: functionId,
129
128
  body: body,
130
129
  headerType: '0',
131
130
  param: {
132
131
  ...otherH5Param,
133
132
  },
134
133
  header: {
135
134
  Referer: window.location.origin,
136
135
  },
137
136
  }
138
137
  const callbackFunction = this._generateCallbackFunction()
139
138
  this.#callbackFunction = callbackFunction
140
139
  this.#requestTimeStamp = Date.now()
141
140
  this.#reportType = HTTP_REQUEST_TYPE.HYBRID
142
141
  window.XWebView.callNative(
143
142
  'ColorQueryPlugin',
144
143
  'colorRequest',
145
144
  JSON.stringify(reqParams),
146
145
  callbackFunction,
147
146
  '1',
148
147
  )
149
148
  window[callbackFunction] = (result) => {
150
149
  this.#responseTimeStamp = Date.now()
151
150
  try {
152
151
  const resultObj =
153
152
  typeof result === 'string' ? JSON.parse(result) : result
154
153
  resolve(resultObj)
155
154
  } catch (error) {
156
155
  const errMsg = 'hybrid网络请求JSON解析失败, error: ' + error
157
156
  draBusinessCustomReport({
158
157
  type: `${HTTP_REQUEST_TYPE.HYBRID}_jsonParseError`,
159
158
  errMsg,
160
159
  result,
161
160
  })
162
161
  reject({ errMsg })
163
162
  }
164
163
  this._clearFunction(callbackFunction)
165
164
  }
166
165
  } catch (error) {
167
166
  reject({
168
167
  errMsg:
169
168
  'hybrid网络请求,App下调用window.XWebView.callNative出错, error: ' +
170
169
  error,
171
170
  })
172
171
  }
173
172
  })
174
173
  }
175
174
 
176
175
  _generateCallbackFunction() {
177
176
  return `hybridHttpRequestCallback_${Date.now()}_${Math.ceil(
178
177
  Math.random() * 100000,
179
178
  )}`
180
179
  }
181
180
 
182
181
  _clearFunction(functionName: string) {
183
182
  try {
184
183
  delete window[functionName]
185
184
  } catch (e) {
186
185
  window[functionName] = undefined
187
186
  }
188
187
  }
189
188
 
190
189
  async _prepareGatewayReqData(
191
190
  data: any,
192
191
  isColorVerify: boolean,
193
192
  ): Promise<any> {
194
193
  const { functionId } = data
195
194
  console.log('获取当前是否需要color加固', isColorVerify, functionId)
196
195
  if (isColorVerify) {
197
196
  const { h5st } = await colorSign.paramsSign(data)
198
197
  h5st && (data.h5st = encodeURI(h5st))
199
198
  console.log(`${functionId}的apiReq_h5st===>:${h5st}`)
200
199
  }
201
200
  const { jsToken } = await colorSign.getFmInfo()
202
201
  console.log(`${functionId}的api jsToken指纹===>:${jsToken}`)
203
202
  jsToken && (data['x-api-eid-token'] = jsToken)
204
203
  return data
205
204
  }
206
205
 
207
206
  _taroRequest(
208
207
  url: string,
209
208
  otherOpts: any,
210
209
  method: string,
211
210
  timeout: number,
212
211
  header: string,
213
212
  ): Promise<any> {
214
213
  const reqParam = {
215
214
  url,
216
215
  method,
217
216
  timeout,
218
217
  header,
219
218
  credentials: 'include',
220
219
  ...otherOpts,
221
220
  }
222
221
  this.#requestTimeStamp = Date.now()
223
222
  this.#reportType = HTTP_REQUEST_TYPE.TARO
224
223
  return Taro.request(reqParam)
225
224
  }
226
225
 
227
226
  _reportRequestTime(url: string, data: any): void {
228
227
  this.#getResTimeStamp = Date.now()
229
228
  if (this.#reportType === HTTP_REQUEST_TYPE.TARO) {
230
229
  this.#responseTimeStamp = this.#getResTimeStamp
231
230
  }
232
231
  draInterfaceCustomReport(
233
232
  {
234
233
  type: `${this.#reportType}_consumeTime`,
235
234
  url,
236
235
  functionId: data?.functionId,
237
236
  requestTimeStamp: this.#requestTimeStamp,
238
237
  responseTimeStamp: this.#responseTimeStamp,
239
238
  errMsg: `使用${this.#reportType}调用接口请求响应耗时`,
240
239
  source: 'remote',
241
240
  },
242
241
  {
243
242
  consumeTime: `${this.#responseTimeStamp - this.#requestTimeStamp}ms`,
244
243
  getResTime: `${this.#getResTimeStamp - this.#requestTimeStamp}ms`,
245
244
  },
246
245
  )
247
246
  }
248
247
 
249
248
  _handleReportInterfaceError(
250
249
  url: string,
251
250
  reqData: any,
252
251
  timeOut: any,
253
252
  res: any,
254
253
  ): void {
255
254
  const source = 'remote'
256
255
  const requestType = this.#reportType
257
256
  let errorType = ''
258
257
  let subMsg = ''
259
258
  let reportFlag = false
260
259
  if (res) {
261
260
  const { statusCode, data, status, resTimeoutState } = res
262
261
  if (statusCode === 500 && resTimeoutState) {
263
262
  reportFlag = true
264
263
  errorType = 'timeout'
265
264
  subMsg = `接口请求超时${timeOut}ms`
266
265
  } else if ((statusCode === 200 || status === '0') && data) {
267
266
  const resCode = Object.prototype.hasOwnProperty.call(data, 'code')
268
267
  ? Number(data.code)
269
268
  : -1
270
269
  const isSuccess = resCode === 0 || resCode === 200
271
270
  if (!isSuccess) {
272
271
  reportFlag = true
273
272
  errorType = 'dataError'
274
273
  subMsg = '接口请求返回数据异常'
275
274
  }
276
275
  } else {
277
276
  reportFlag = true
278
277
  errorType = 'statusError'
279
278
  subMsg = '接口请求本身异常'
280
279
  }
281
280
  }
282
281
  reportFlag &&
283
282
  draInterfaceCustomReport({
284
283
  subMsg,
285
284
  url,
286
285
  source,
287
286
  requestType,
288
287
  errorType,
289
288
  ...reqData,
290
289
  ...res,
291
290
  })
292
291
  }
292
+ import Taro from '@tarojs/taro'
293
293
  isSupportHybridHttpRequest,
294
294
  draInterfaceCustomReport,
295
295
  draBusinessCustomReport,
296
296
  jsonHeader = 'application/json;charset=utf-8',
297
297
  formDataHeader = 'application/x-www-form-urlencoded',
298
298
  HYBRID: 'httpRequest_hybrid',
299
299
  TARO: 'httpRequest_taro',
300
300
  #requestTimeStamp: number
301
301
  #responseTimeStamp: number
302
302
  #getResTimeStamp: number
303
303
  #reportType: string
304
304
  #callbackFunction: string
305
305
 
306
306
  async request({
307
307
  url,
308
308
  method = 'POST',
309
309
  timeout = 7000,
310
310
  isColorVerify = false,
311
311
  ...otherOptions
312
312
  }): Promise<Taro.request.SuccessCallbackResult<any>> {
313
313
  const { header: otherHeader, ...otherOpts } = otherOptions
314
314
  const header = {
315
315
  'content-type':
316
316
  method === 'POST'
317
317
  ? RequestHeaderContentType.formDataHeader
318
318
  : RequestHeaderContentType.jsonHeader,
319
319
  ...otherHeader,
320
320
  }
321
321
  let getRequestUrl = url
322
322
  let requestTask
323
323
  const data = otherOpts?.data
324
324
  const isGatewayRequest =
325
325
  url === this.api.apiFunc && typeof data === 'object'
326
326
  if (isGatewayRequest) {
327
327
  getRequestUrl = this._handleSpecialGatewayUrl(url)
328
328
  const shouldUseHybridRequest = this._shouldUseHybridRequest()
329
329
  if (shouldUseHybridRequest) {
330
330
  requestTask = this._hybridRequest(getRequestUrl, data)
331
331
  } else {
332
332
  otherOpts.data = await this._prepareGatewayReqData(data, isColorVerify)
333
333
  requestTask = this._taroRequest(
334
334
  getRequestUrl,
335
335
  otherOpts,
336
336
  method,
337
337
  timeout,
338
338
  header,
339
339
  )
340
340
  }
341
341
  } else {
342
342
  requestTask = this._taroRequest(
343
343
  getRequestUrl,
344
344
  otherOpts,
345
345
  method,
346
346
  timeout,
347
347
  header,
348
348
  )
349
349
  }
350
350
  const requestTimeoutPromise =
351
351
  new Promise<ServiceInterFace.RequestPromiseRes>((resolve) => {
352
352
  setTimeout(() => {
353
353
  resolve({
354
354
  statusCode: 500,
355
355
  resTimeoutState: true,
356
356
  errMsg: 'request timeout',
357
357
  })
358
358
  }, timeout)
359
359
  })
360
360
  return Promise.race([requestTask, requestTimeoutPromise]).then(
361
361
  (res: any) => {
362
362
  if (res && res.statusCode === 500 && res.resTimeoutState) {
363
363
  if (this.#reportType === HTTP_REQUEST_TYPE.HYBRID) {
364
364
  this._clearFunction(this.#callbackFunction)
365
365
  } else {
366
366
  requestTask.abort && requestTask.abort()
367
367
  }
368
368
  }
369
369
  this._handleReportInterfaceError(url, data, timeout, res)
370
370
  return res
371
371
  },
372
372
  )
373
373
  }
374
374
 
375
375
  _handleSpecialGatewayUrl(url: string): string {
376
376
  if (isPc && window.location.hostname.includes('.jd.hk')) {
377
377
  return this.api.hkApiFunc
378
378
  }
379
379
  if (
380
380
  isJdApp &&
381
381
  window?.shopGlobalSwitch?.dualProtocol &&
382
382
  !window.location.href.includes('jshopx_vconsole')
383
383
  ) {
384
384
  return window?.shopGlobalSwitch?.dualProtocol?.apiTestApp || url
385
385
  }
386
386
  return url
387
387
  }
388
388
 
389
389
  _shouldUseHybridRequest(): boolean {
390
390
  try {
391
391
  if (!isJdApp || !isSupportHybridHttpRequest || isJdAndHarmonyDevice) {
392
392
  return false
393
393
  }
394
394
  const configData = global.getDynamicConfig('hybridHttpSwitch')
395
395
  const { globalOn = false, grayscale = {} } = configData || {}
396
396
  const buildType = process.env.BUILD_TYPE || ''
397
397
  const isInvokeGray = globalOn || grayscale[buildType]
398
398
  console.log(
399
399
  '使用hybrid请求是否命中灰度,isInvokeGray:',
400
400
  isInvokeGray,
401
401
  '获取mpaas配置hybridHttpSwitch原始数据configData',
402
402
  configData,
403
403
  )
404
404
  const hasWindowXWebView = !!window.XWebView
405
405
  return isInvokeGray && hasWindowXWebView
406
406
  } catch (e) {
407
407
  console.log('获取是否使用Hybrid请求出错,e:', e)
408
408
  return false
409
409
  }
410
410
  }
411
411
 
412
412
  _hybridRequest(url: string, data: any): Promise<any> {
413
413
  return new Promise((resolve, reject) => {
414
414
  try {
415
415
  const changeCurrentUrl = url.startsWith('//') ? `https:${url}` : url
416
416
  const { functionId, body, ...otherH5Param } = data
417
417
  const reqParams = {
418
418
  url: isIosDevice ? `${changeCurrentUrl}/` : changeCurrentUrl,
419
419
  functionId: functionId,
420
420
  body: body,
421
421
  headerType: '0',
422
422
  param: {
423
423
  ...otherH5Param,
424
424
  },
425
425
  header: {
426
426
  Referer: window.location.origin,
427
427
  },
428
428
  }
429
429
  const callbackFunction = this._generateCallbackFunction()
430
430
  this.#callbackFunction = callbackFunction
431
431
  this.#requestTimeStamp = Date.now()
432
432
  this.#reportType = HTTP_REQUEST_TYPE.HYBRID
433
433
  window.XWebView.callNative(
434
434
  'ColorQueryPlugin',
435
435
  'colorRequest',
436
436
  JSON.stringify(reqParams),
437
437
  callbackFunction,
438
438
  '1',
439
439
  )
440
440
  window[callbackFunction] = (result) => {
441
441
  this.#responseTimeStamp = Date.now()
442
442
  try {
443
443
  const resultObj =
444
444
  typeof result === 'string' ? JSON.parse(result) : result
445
445
  resolve(resultObj)
446
446
  } catch (error) {
447
447
  const errMsg = 'hybrid网络请求JSON解析失败, error: ' + error
448
448
  draBusinessCustomReport({
449
449
  type: `${HTTP_REQUEST_TYPE.HYBRID}_jsonParseError`,
450
450
  errMsg,
451
451
  result,
452
452
  })
453
453
  reject({ errMsg })
454
454
  }
455
455
  this._clearFunction(callbackFunction)
456
456
  }
457
457
  } catch (error) {
458
458
  reject({
459
459
  errMsg:
460
460
  'hybrid网络请求,App下调用window.XWebView.callNative出错, error: ' +
461
461
  error,
462
462
  })
463
463
  }
464
464
  })
465
465
  }
466
466
 
467
467
  _generateCallbackFunction() {
468
468
  return `hybridHttpRequestCallback_${Date.now()}_${Math.ceil(
469
469
  Math.random() * 100000,
470
470
  )}`
471
471
  }
472
472
 
473
473
  _clearFunction(functionName: string) {
474
474
  try {
475
475
  delete window[functionName]
476
476
  } catch (e) {
477
477
  window[functionName] = undefined
478
478
  }
479
479
  }
480
480
 
481
481
  async _prepareGatewayReqData(
482
482
  data: any,
483
483
  isColorVerify: boolean,
484
484
  ): Promise<any> {
485
485
  const { functionId } = data
486
486
  console.log('获取当前是否需要color加固', isColorVerify, functionId)
487
487
  if (isColorVerify) {
488
488
  const { h5st } = await colorSign.paramsSign(data)
489
489
  h5st && (data.h5st = encodeURI(h5st))
490
490
  console.log(`${functionId}的apiReq_h5st===>:${h5st}`)
491
491
  }
492
492
  const { jsToken } = await colorSign.getFmInfo()
493
493
  console.log(`${functionId}的api jsToken指纹===>:${jsToken}`)
494
494
  jsToken && (data['x-api-eid-token'] = jsToken)
495
495
  return data
496
496
  }
497
497
 
498
498
  _taroRequest(
499
499
  url: string,
500
500
  otherOpts: any,
501
501
  method: string,
502
502
  timeout: number,
503
503
  header: string,
504
504
  ): Promise<any> {
505
505
  const reqParam = {
506
506
  url,
507
507
  method,
508
508
  timeout,
509
509
  header,
510
510
  credentials: 'include',
511
511
  ...otherOpts,
512
512
  }
513
513
  this.#requestTimeStamp = Date.now()
514
514
  this.#reportType = HTTP_REQUEST_TYPE.TARO
515
515
  return Taro.request(reqParam)
516
516
  }
517
517
 
518
518
  _reportRequestTime(url: string, data: any): void {
519
519
  this.#getResTimeStamp = Date.now()
520
520
  if (this.#reportType === HTTP_REQUEST_TYPE.TARO) {
521
521
  this.#responseTimeStamp = this.#getResTimeStamp
522
522
  }
523
523
  draInterfaceCustomReport(
524
524
  {
525
525
  type: `${this.#reportType}_consumeTime`,
526
526
  url,
527
527
  functionId: data?.functionId,
528
528
  requestTimeStamp: this.#requestTimeStamp,
529
529
  responseTimeStamp: this.#responseTimeStamp,
530
530
  errMsg: `使用${this.#reportType}调用接口请求响应耗时`,
531
531
  source: 'remote',
532
532
  },
533
533
  {
534
534
  consumeTime: `${this.#responseTimeStamp - this.#requestTimeStamp}ms`,
535
535
  getResTime: `${this.#getResTimeStamp - this.#requestTimeStamp}ms`,
536
536
  },
537
537
  )
538
538
  }
539
539
 
540
540
  _handleReportInterfaceError(
541
541
  url: string,
542
542
  reqData: any,
543
543
  timeOut: any,
544
544
  res: any,
545
545
  ): void {
546
546
  const source = 'remote'
547
547
  const requestType = this.#reportType
548
548
  let errorType = ''
549
549
  let subMsg = ''
550
550
  let reportFlag = false
551
551
  if (res) {
552
552
  const { statusCode, data, status, resTimeoutState } = res
553
553
  if (statusCode === 500 && resTimeoutState) {
554
554
  reportFlag = true
555
555
  errorType = 'timeout'
556
556
  subMsg = `接口请求超时${timeOut}ms`
557
557
  } else if ((statusCode === 200 || status === '0') && data) {
558
558
  const resCode = Object.prototype.hasOwnProperty.call(data, 'code')
559
559
  ? Number(data.code)
560
560
  : -1
561
561
  const isSuccess = resCode === 0 || resCode === 200 || data?.success
562
562
  if (!isSuccess) {
563
563
  reportFlag = true
564
564
  errorType = 'dataError'
565
565
  subMsg = '接口请求返回数据异常'
566
566
  }
567
567
  } else {
568
568
  reportFlag = true
569
569
  errorType = 'statusError'
570
570
  subMsg = '接口请求本身异常'
571
571
  }
572
572
  }
573
573
  reportFlag &&
574
574
  draInterfaceCustomReport({
575
575
  subMsg,
576
576
  url,
577
577
  source,
578
578
  requestType,
579
579
  errorType,
580
580
  code: res?.data?.code,
581
581
  body: reqData?.body,
582
582
  appid: reqData?.appId,
583
583
  t: reqData?.t,
584
584
  client: reqData?.client,
585
585
  clientVersion: reqData?.clientVersion,
586
586
  ...res,
587
587
  })
588
588
  }