king
2024-10-07 a26f13ee999e84fc49cc3545e6e5d3daf9c6c41f
src/api/index.js
@@ -492,26 +492,26 @@
  /**
   * @description 获取或修改系统配置,增加appkey
   */
  getSystemFuncs (time) {
    let param = {
      func: 's_get_func_base_sso',
      update_date: time,
      userid: sessionStorage.getItem('UserID') || '',
      lang: sessionStorage.getItem('lang') || '',
      SessionUid: localStorage.getItem('SessionUid') || '',
      LoginUID: sessionStorage.getItem('LoginUID') || '',
      appkey: window.GLOB.appkey
    }
  // getSystemFuncs (time) {
  //   let param = {
  //     func: 's_get_func_base_sso',
  //     update_date: time,
  //     userid: sessionStorage.getItem('UserID') || '',
  //     lang: sessionStorage.getItem('lang') || '',
  //     SessionUid: localStorage.getItem('SessionUid') || '',
  //     LoginUID: sessionStorage.getItem('LoginUID') || '',
  //     appkey: window.GLOB.appkey
  //   }
    let url = window.GLOB.mainSystemApi || '/webapi/dostars'
    param = this.encryptParam(param)
  //   let url = window.GLOB.mainSystemApi || '/webapi/dostars'
  //   param = this.encryptParam(param)
    return axios({
      url: `${url}/${param.func}`,
      method: 'post',
      data: JSON.stringify(param)
    })
  }
  //   return axios({
  //     url: `${url}/${param.func}`,
  //     method: 'post',
  //     data: JSON.stringify(param)
  //   })
  // }
  /**
   * @description 获取或修改系统配置,增加appkey
@@ -670,6 +670,65 @@
    param.SessionUid = localStorage.getItem('SessionUid') || ''
    param.LoginUID = param.LoginUID || sessionStorage.getItem('LoginUID') || ''
    param.appkey = window.GLOB.appkey || ''
    if (param.$backend) {
      delete param.$backend
      let id = ''
      if (cache) {
        id = param.data[0].id
        if (window.GLOB.CacheMap.has(id)) {
          return Promise.resolve(window.GLOB.CacheMap.get(id))
        }
      }
      param.username = sessionStorage.getItem('User_Name') || ''
      param.fullname = sessionStorage.getItem('Full_Name') || ''
      param.s_debug = window.GLOB.debugger ? 'Y' : ''
      param.data_md5 = param.data_md5 || ''
      param.time_limit = param.time_limit || 0
      let url = '/webapi/exstars'
      if (param.rduri) {
        param.rduri = param.rduri.replace(/dostars/ig, 'exstars')
        if (!window.GLOB.transfer) {
          url = param.rduri
          delete param.rduri
        }
      }
      if (param.$type) {
        url += '/' + param.$type
      }
      delete param.$type
      param = this.encryptParam(param)
      return new Promise((resolve) => {
        axios({
          url: url,
          method: 'post',
          data: JSON.stringify(param)
        }).then(res => {
          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.ErrCode === 'version_error') {
            res.ErrCode = '-2'
            MKEmitter.emit('reloadTabs')
          }
          if (res.status && id) {
            window.GLOB.CacheMap.set(id, res)
          }
          resolve(res)
        })
      })
    }
    let url = '/webapi/dostars'
    if (param.rduri && !window.GLOB.transfer) {
@@ -938,6 +997,52 @@
          }
        })
      })
    } else if (param.$backend) {
      delete param.$backend
      let url = '/webapi/exstars'
      if (param.rduri) {
        param.rduri = param.rduri.replace(/dostars/ig, 'exstars')
        if (!window.GLOB.transfer) {
          url = param.rduri
          delete param.rduri
        }
      }
      if (param.$type) {
        url += '/' + param.$type
      }
      delete param.$type
      param.username = sessionStorage.getItem('User_Name') || ''
      param.fullname = sessionStorage.getItem('Full_Name') || ''
      param.s_debug = window.GLOB.debugger ? 'Y' : ''
      param.data_md5 = param.data_md5 || ''
      param.time_limit = param.time_limit || 0
      param = this.encryptParam(param)
      return new Promise((resolve) => {
        axios({
          url: url,
          method: 'post',
          data: JSON.stringify(param),
          requestId
        }).then(res => {
          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.ErrCode === 'version_error') {
            res.ErrCode = '-2'
            MKEmitter.emit('reloadTabs')
          }
          resolve(res)
        })
      })
    } else {
      let url = '/webapi/dostars'
      if (param.rduri && (!window.GLOB.transfer || /https:\/\/sso.mk9h.cn/.test(param.rduri)) && /\/dostars/.test(param.rduri) && param.func !== 'webapi_ChangeUser') {
@@ -957,6 +1062,27 @@
  }
  /**
   * @description 清空后端缓存
   */
  cacheInterface (param) {
    param.appkey = window.GLOB.appkey || ''
    let url = '/webapi/excache'
    if (param.rduri && !window.GLOB.transfer) {
      url = param.rduri
      delete param.rduri
    }
    param = this.encryptParam(param)
    return axios({
      url: url,
      method: 'post',
      data: JSON.stringify(param),
    })
  }
  /**
   * @description 上传base64
   * @param {String} base64 base64图片编码
   */