king
2024-12-24 5f69e3bf213ccc377dc118b89bb8db348eafbc1d
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))
          }
        }
      }
    }
  }