From 58826d6f4eab9f8c9acf9fa8696f60039c645cfe Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期二, 20 八月 2024 18:18:00 +0800 Subject: [PATCH] 2024-08-20 --- src/api/index.js | 101 ++++++++++++++++++++++++++++++-------------------- 1 files changed, 60 insertions(+), 41 deletions(-) diff --git a/src/api/index.js b/src/api/index.js index 3717fe7..b24fd12 100644 --- a/src/api/index.js +++ b/src/api/index.js @@ -100,15 +100,15 @@ /** * @description 寰俊涓氬姟璇锋眰 鍘熸帴鍙� 'wxpay/getaccesstoken' */ - wxAccessToken (appId, domain = '') { - let _url = domain || window.GLOB.baseurl + // wxAccessToken (appId, domain = '') { + // let _url = domain || window.GLOB.baseurl - return axios({ - url: _url + 'wechat/getaccesstoken', - method: 'post', - data: JSON.stringify({app_id: appId}) - }) - } + // return axios({ + // url: _url + 'wechat/getaccesstoken', + // method: 'post', + // data: JSON.stringify({app_id: appId}) + // }) + // } /** * @description 寰俊涓氬姟璇锋眰 @@ -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 @@ -999,26 +999,45 @@ /** * @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) { + if (!/Content\/images/.test(res.urlPath)) { + let key = CryptoJS.enc.Utf8.parse('D1185ED7B32568C9') + let wordArray = CryptoJS.enc.Base64.parse(res.urlPath) + let decryptedWordArray = CryptoJS.AES.decrypt({ ciphertext: wordArray }, key, { mode: CryptoJS.mode.ECB, padding: CryptoJS.pad.Pkcs7 }) + res.urlPath = CryptoJS.enc.Utf8.stringify(decryptedWordArray) + } + if (!/^http/.test(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鏂囦欢涓婁紶 @@ -1102,7 +1121,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