From 3728c728f6106b14e2149bcc7f45de437460c71f Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期五, 27 十二月 2024 21:27:25 +0800 Subject: [PATCH] Merge branch 'positec' into dms --- src/api/index.js | 26 ++++++++++++++++++++++++++ 1 files changed, 26 insertions(+), 0 deletions(-) diff --git a/src/api/index.js b/src/api/index.js index 3b725fd..1538ed0 100644 --- a/src/api/index.js +++ b/src/api/index.js @@ -86,6 +86,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) -- Gitblit v1.8.0