king
2023-05-25 972f277c5920d9d38749d675912b47b2b120320e
src/api/index.js
@@ -98,17 +98,18 @@
  /**
   * @description 微信业务请求
   */
  wxAccessToken () {
  wxAccessToken (domain = '') {
    let _url = window.GLOB.baseurl + 'wxpay/getaccesstoken'
    if (process.env.NODE_ENV !== 'production') {
      _url = document.location.origin + '/wxpay/getaccesstoken'
    if (domain) {
      _url = domain + 'wxpay/getaccesstoken'
    }
    return new Promise(resolve => {
      if (window.GLOB.accessToken.accessTime && (parseInt(new Date().getTime() / 1000) - window.GLOB.accessToken.accessTime < 30)) {
      if (window.GLOB.accessToken.domain === domain && window.GLOB.accessToken.accessTime && (parseInt(new Date().getTime() / 1000) - window.GLOB.accessToken.accessTime < 30)) {
        resolve(window.GLOB.accessToken)
      } else {
        window.GLOB.accessToken = {}
        window.GLOB.accessToken = {domain}
        axios({
          url: _url,
          method: 'get'
@@ -128,7 +129,10 @@
   * @description 微信业务请求
   */
  wxNginxRequest (url, method, param) {
    let _url = window.GLOB.location + '/' + url
    let _url = url
    if (!/^http/.test(url)) {
      _url = window.GLOB.location + '/' + url
    if (process.env.NODE_ENV === 'production') {
      _url = document.location.origin + '/' + url
    }
@@ -141,6 +145,7 @@
      _url = window.GLOB.location + ':8443/' + url
      if (process.env.NODE_ENV === 'production') {
        _url = document.location.origin + ':8443/' + url
        }
      }
    }
    
@@ -1026,9 +1031,6 @@
   */
  getWxNativePay (param) {
    let _url = window.GLOB.baseurl + 'wxpay/wxNativePay'
    if (process.env.NODE_ENV !== 'production') {
      _url = document.location.origin + '/wxpay/wxNativePay'
    }
    return axios({
      url: _url,