From 5f69e3bf213ccc377dc118b89bb8db348eafbc1d Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期二, 24 十二月 2024 22:36:03 +0800 Subject: [PATCH] 2024-12-24 --- src/api/index.js | 26 ++++++++++++++++++++++++-- 1 files changed, 24 insertions(+), 2 deletions(-) diff --git a/src/api/index.js b/src/api/index.js index ebf3f56..0a95a2e 100644 --- a/src/api/index.js +++ b/src/api/index.js @@ -74,9 +74,31 @@ placement: 'bottomRight', duration: 15 }) - if ([404, 500, 504].includes(response.status) && error.config && error.config.url) { + if ([500, 504].includes(response.status) && error.config && error.config.url && error.config.data) { window.mkInfo(error.config.url) - error.config.data && window.mkInfo(error.config.data) + 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(response.config.url) && !/s_special_error_note_log/.test(response.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)) + } + } + } } } -- Gitblit v1.8.0