Ver Fonte

修改日志结构

zhongxiaoyu há 3 anos atrás
pai
commit
d38cfcfea3
1 ficheiros alterados com 10 adições e 4 exclusões
  1. 10 4
      src/utils/request.js

+ 10 - 4
src/utils/request.js

@@ -1,7 +1,7 @@
 /*
  * @Author: your name
  * @Date: 2022-01-06 09:45:17
- * @LastEditTime: 2022-04-14 15:01:34
+ * @LastEditTime: 2022-04-14 16:15:03
  * @LastEditors: your name
  * @Description: axios封装
  */
@@ -46,7 +46,7 @@ service.interceptors.request.use(
         text: '数据加载中'
       })
     }
-    if (config.url.includes('/api/fs4a/sendLog') && config.data.Data[0]?.OperateResult.Token) {
+    if (config.url.includes('/api/fs4a/sendLog') && config.data.Data[0]?.OperateResult?.Token) {
       config.headers['token'] = config.data.Data[0].OperateResult.Token
     }
     config.metaData = {
@@ -85,6 +85,7 @@ service.interceptors.response.use(
         OperateResult: res.returnData,
         Ident: Ident ?? ''
       })
+      const { BeginTime, EndTime, OperateResult } = metaData
       const config = {
         url: '/api/fs4a/sendLog',
         method: 'post',
@@ -93,11 +94,16 @@ service.interceptors.response.use(
           BrowserTag: navigator.userAgent,
           OperateIP: returnCitySN.cip,
           Msg: msg,
-          Type: '2'
+          Type: '2',
+          BeginTime,
+          EndTime,
+          OperateResult
         }
       }
       if (islogin) {
-        config.data.OperatorId = config.data.Operator = res.returnData.UserId.toString()
+        if (res.returnData) {
+          config.data.OperatorId = config.data.Operator = res.returnData.UserId.toString()
+        }
       } else {
         config.data.OperatorId = config.data.Operator = getUserId()
       }