From 70f30488f31c2adb1cfb3cb2452ea27c85167019 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期二, 06 八月 2024 11:22:19 +0800
Subject: [PATCH] 2024-08-06

---
 src/api/index.js |   94 ++++++++++++++++++++++++++++-------------------
 1 files changed, 56 insertions(+), 38 deletions(-)

diff --git a/src/api/index.js b/src/api/index.js
index a2ca5e0..768aa69 100644
--- a/src/api/index.js
+++ b/src/api/index.js
@@ -100,28 +100,15 @@
   /**
    * @description 寰俊涓氬姟璇锋眰 鍘熸帴鍙� 'wxpay/getaccesstoken'
    */
-  wxAccessToken (appId, domain = '') {
-    let _url = domain || window.GLOB.baseurl
+  // wxAccessToken (appId, domain = '') {
+  //   let _url = domain || window.GLOB.baseurl
 
-    return new Promise(resolve => {
-      if (window.GLOB.accessToken.appId === appId && window.GLOB.accessToken.accessTime && (parseInt(new Date().getTime() / 1000) - window.GLOB.accessToken.accessTime < 30)) {
-        resolve(window.GLOB.accessToken)
-      } else {
-        window.GLOB.accessToken = {appId}
-        axios({
-          url: _url + 'wechat/getaccesstoken',
-          method: 'post',
-          data: JSON.stringify({app_id: appId})
-        }).then(res => {
-          if (res.access_token) {
-            window.GLOB.accessToken.accessTime = parseInt(new Date().getTime() / 1000)
-            window.GLOB.accessToken.access_token = res.access_token
-          }
-          resolve(res)
-        })
-      }
-    })
-  }
+  //   return axios({
+  //     url: _url + 'wechat/getaccesstoken',
+  //     method: 'post',
+  //     data: JSON.stringify({app_id: appId})
+  //   })
+  // }
 
   /**
    * @description 寰俊涓氬姟璇锋眰
@@ -160,7 +147,27 @@
   /**
    * @description 鐩存帴璇锋眰
    */
-  directRequest (params) {
+  directRequest (params, script, position) {
+    if (script) {
+      try {
+        // eslint-disable-next-line
+        let func = new Function('axios', 'Api', 'param', 'position', 'systemType', 'notification', script)
+        let promise = func(axios, this, params, position, window.GLOB.systemType, notification)
+
+        if (promise instanceof Promise) {
+          return promise
+        }
+      } catch (e) {
+        console.warn(e)
+      }
+
+      return Promise.resolve({
+        status: false,
+        message: '鑷畾涔夎剼鏈墽琛岄敊璇�',
+        ErrCode: 'E'
+      })
+    }
+    
     return axios(params)
   }
 
@@ -933,7 +940,7 @@
       })
     } else {
       let url = '/webapi/dostars'
-      if (param.rduri && !window.GLOB.transfer && /\/dostars/.test(param.rduri) && param.func !== 'webapi_ChangeUser') {
+      if (param.rduri && (!window.GLOB.transfer || /https:\/\/sso.mk9h.cn/.test(param.rduri)) && /\/dostars/.test(param.rduri) && param.func !== 'webapi_ChangeUser') {
         url = param.rduri
         delete param.rduri
       }
@@ -992,26 +999,37 @@
   /**
    * @description 澶ф枃浠朵笂浼�
    */
-  getLargeFileUpload (param) {
-    return axios({
-      url: '/webapi/doupload',
-      method: 'post',
-      headers: { 'Content-Type': 'multipart/form-data' },
-      data: param
+  getFileUpload (param) {
+    param.append('shardingCnt', 1)
+    param.append('LoginUID', sessionStorage.getItem('LoginUID') || '')
+    param.append('UserID', sessionStorage.getItem('UserID') || '')
+
+    return new Promise((resolve, reject) => {
+      axios({
+        url: '/webapi/doupload',
+        method: 'post',
+        headers: { 'Content-Type': 'multipart/form-data' },
+        data: param
+      }).then(res => {
+        if (res.status && res.urlPath) {
+          res.urlPath = window.GLOB.baseurl + res.urlPath
+        }
+        resolve(res)
+      })
     })
   }
 
   /**
    * @description 鏌ヨ鏂囦欢鏄惁宸蹭笂浼�
    */
-  getFilePreUpload (param) {
-    return axios({
-      url: '/webapi/dopreload',
-      method: 'post',
-      headers: { 'Content-Type': 'multipart/form-data' },
-      data: param
-    })
-  }
+  // getFilePreUpload (param) {
+  //   return axios({
+  //     url: '/webapi/dopreload',
+  //     method: 'post',
+  //     headers: { 'Content-Type': 'multipart/form-data' },
+  //     data: param
+  //   })
+  // }
 
   /**
    * @description oss鏂囦欢涓婁紶
@@ -1095,7 +1113,7 @@
       sql = sql.replace(/@db@/ig, window.GLOB.externalDatabase)
     }
 
-    console.info(`/* sql 楠岃瘉 */\n${sql.replace(/\n\s{6,20}/ig, '\n')}`)
+    window.mkInfo(`/* sql 楠岃瘉 */\n${sql.replace(/\n\s{6,20}/ig, '\n')}`)
 
     sql = sql.replace(/\n/ig, ' ')
 

--
Gitblit v1.8.0