From 1adfb2b7ad4965f15dae773e0dd9b22c6e103fd8 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期二, 31 十二月 2024 18:09:03 +0800
Subject: [PATCH] 2024-12-31

---
 src/api/index.js |   38 ++++++++++++++++++++++++++++++++++++--
 1 files changed, 36 insertions(+), 2 deletions(-)

diff --git a/src/api/index.js b/src/api/index.js
index 2f9193c..b76ef61 100644
--- a/src/api/index.js
+++ b/src/api/index.js
@@ -74,6 +74,32 @@
       placement: 'bottomRight',
       duration: 15
     })
+    if ([500, 504].includes(response.status) && error.config && error.config.url && error.config.data) {
+      window.mkInfo(error.config.url)
+      window.mkInfo(error.config.data)
+      if (window.GLOB.errorLog && !sessionStorage.getItem('local_error')) {
+        let urlReg = new RegExp('^(' + window.GLOB.baseurl + '|/)webapi/(exstars|dostars)', 'ig')
+        if (urlReg.test(error.config.url) && !/s_special_error_note_log/.test(error.config.url)) {
+          let res = null
+          try {
+            let data = JSON.parse(error.config.data)
+            if (!data.rduri) {
+              res = {
+                api_url: error.config.url,
+                error_code: response.status,
+                error_time: moment().format('YYYY-MM-DD HH:mm:ss'),
+                api_param: error.config.data
+              }
+            }
+          } catch (e) {
+            res = null
+          }
+          if (res) {
+            sessionStorage.setItem('local_error', JSON.stringify(res))
+          }
+        }
+      }
+    }
   }
 
   return Promise.reject(response)
@@ -710,7 +736,11 @@
           if (res.mksqls) {
             res.mksqls.forEach(n => {
               n = n.replace(/(UNION ALL\s+)?SELECT obj_name='[\S\s]+sub_field=''\s+/ig, '')
-              window.mkInfo(n)
+              if (!res.status) {
+                window.mkInfo('%c' + n, 'color: #f5222d')
+              } else {
+                window.mkInfo(n)
+              }
             })
           }
           delete res.mksqls
@@ -1029,7 +1059,11 @@
           if (res.mksqls) {
             res.mksqls.forEach(n => {
               n = n.replace(/(UNION ALL\s+)?SELECT obj_name='[\S\s]+sub_field=''\s+/ig, '')
-              window.mkInfo(n)
+              if (!res.status) {
+                window.mkInfo('%c' + n, 'color: #f5222d')
+              } else {
+                window.mkInfo(n)
+              }
             })
           }
           delete res.mksqls

--
Gitblit v1.8.0