From 1bec8d69cf14bd88591eee5b0320c5c8f6c25a08 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期五, 08 三月 2024 21:19:31 +0800 Subject: [PATCH] Merge branch 'master' into positec --- src/api/index.js | 113 +++++++++++++++++++++++++++++++++++++++++++------------- 1 files changed, 87 insertions(+), 26 deletions(-) diff --git a/src/api/index.js b/src/api/index.js index c4afd62..b340607 100644 --- a/src/api/index.js +++ b/src/api/index.js @@ -57,6 +57,9 @@ return Promise.reject(response.data) } else { + if (response.config.requestId) { + response.data.$requestId = response.config.requestId + } return Promise.resolve(response.data) } }, (error) => { @@ -303,6 +306,11 @@ // Type: 'X' 鏃� // param.Password = Utils.formatOptions(password) + // positecgroup + if (window.GLOB.appkey === '202011021844144334E823A3011414082AD77') { + param.svccode = 'oms' + } + let url = '/webapi/dologon' if (isCloud) { @@ -350,6 +358,36 @@ resolve({data: null, valid: false}) } }) + }) + } + + /** + * @description 鐧诲綍浜屾楠岃瘉 // positecgroup + */ + verifycode (verify) { + let param = { + certificate: 'certificate', + captcha: verify.code, + token: verify.token, + ati: verify.ati, + vid: verify.vid, + uid: verify.uid, + shopId: verify.shopId, + loginId: verify.loginId, + phone: verify.phone, + sellerNick: verify.sellerNick, + isRisk: verify.isRisk, + requestId: verify.requestId, + riskNum: verify.riskNum, + username: verify.username + } + + let url = '/webapi/dologon' + + return axios({ + url, + method: 'post', + data: param }) } @@ -645,7 +683,7 @@ param.sign = md5(values) param.t = new Date().getTime(); - ['arr_field', 'LText_field', 'custom_script', 'LText1', 'LText', 'LText2', 'DateCount'].forEach(key => { + ['arr_field', 'custom_script', 'LText', 'DateCount'].forEach(key => { if (param[key]) { let val = param[key] delete param[key] @@ -669,7 +707,7 @@ param.appkey = window.GLOB.appkey || '' let url = '/webapi/dostars' - if (param.rduri && !window.GLOB.transfer) { + if (param.rduri && !window.GLOB.transfer) { // positecgroup url = param.rduri delete param.rduri } @@ -755,7 +793,7 @@ param = this.encryptParam(param) axios({ - url: token.interface, + url: `${token.interface}${param.func ? '/' + param.func : ''}`, method: 'post', data: JSON.stringify(param) }).then(res => { @@ -804,7 +842,7 @@ param = this.encryptParam(param) axios({ - url: token.interface, + url: `${token.interface}${param.func ? '/' + param.func : ''}`, method: 'post', data: JSON.stringify(param) }).then(res => { @@ -834,7 +872,7 @@ * @description 鑾峰彇涓氬姟閫氱敤鎺ュ彛 * 璁块棶 'https://sso.mk9h.cn/webapi/dostars'鎴栦簯绔椂锛屼紶鍏serid銆丩oginUID */ - genericInterface (param) { + genericInterface (param, script = '', position, requestId = '') { param.userid = param.userid || sessionStorage.getItem('UserID') || '' param.lang = param.lang || sessionStorage.getItem('lang') || '' param.SessionUid = localStorage.getItem('SessionUid') || '' @@ -852,9 +890,6 @@ param.fullname = sessionStorage.getItem('Full_Name') || '' } - let login = false - let rduri = null - if (param.rduri && /\s|\n/.test(param.rduri)) { param.rduri = param.rduri.replace(/\s|\n/g, '') if (!param.rduri) { @@ -862,22 +897,32 @@ } } - if (param.$login && !window.GLOB.transfer) { - login = true - rduri = param.rduri || '' - } - delete param.$login + if (script) { + try { + // eslint-disable-next-line + let func = new Function('axios', 'Api', 'param', 'position', 'systemType', script) + let promise = func(axios, this, param, position, window.GLOB.systemType) - let url = '/webapi/dostars' + if (promise instanceof Promise) { + return promise + } + } catch (e) { + console.warn(e) + } - if (param.rduri && !window.GLOB.transfer && /\/dostars/.test(param.rduri) && param.func !== 'webapi_ChangeUser') { - url = param.rduri + return Promise.resolve({ + status: false, + message: '鑷畾涔夎剼鏈墽琛岄敊璇�', + ErrCode: 'E' + }) + } else if (param.$login) { + let rduri = param.rduri || '' + + delete param.$login delete param.rduri - } - param = this.encryptParam(param) + param = this.encryptParam(param) - if (login) { let time = +sessionStorage.getItem(rduri) let c_time = Math.round(new Date().getTime() / 1000) @@ -885,7 +930,7 @@ sessionStorage.setItem(rduri, c_time) return new Promise((resolve, reject) => { axios({ - url: `${url}${param.func ? '/' + param.func : ''}`, + url: `${rduri}${param.func ? '/' + param.func : ''}`, method: 'post', data: JSON.stringify(param) }).then(result => { @@ -904,7 +949,7 @@ if (res.status) { sessionStorage.setItem(rduri, c_time) axios({ - url: `${url}${param.func ? '/' + param.func : ''}`, + url: `${rduri}${param.func ? '/' + param.func : ''}`, method: 'post', data: JSON.stringify(param) }).then(result => { @@ -929,10 +974,19 @@ }) }) } else { + let url = '/webapi/dostars' + if (param.rduri && !window.GLOB.transfer && /\/dostars/.test(param.rduri) && param.func !== 'webapi_ChangeUser') { + url = param.rduri + delete param.rduri + } + + param = this.encryptParam(param) + return axios({ url: `${url}${param.func ? '/' + param.func : ''}`, method: 'post', - data: JSON.stringify(param) + data: JSON.stringify(param), + requestId }) } } @@ -1056,7 +1110,7 @@ sDebug (sql, rduri = null) { let param = { func: 's_debug_sql', - exec_type: 'y', + exec_type: window.GLOB.execType || 'y', timestamp: moment().format('YYYY-MM-DD HH:mm:ss'), userid: sessionStorage.getItem('UserID') || '', lang: sessionStorage.getItem('lang') || '', @@ -1065,8 +1119,15 @@ appkey: window.GLOB.appkey || '' } - let id = Utils.getuuid() - sql = sql.replace(/@time_id@/ig, `'${id}'`) + sql = sql.replace(/@time_id@/ig, `'${Utils.getuuid()}'`) + sql = sql.replace(/@ID@/ig, `'${Utils.getuuid()}'`) + sql = sql.replace(/@BID@/ig, `'${Utils.getuuid()}'`) + sql = sql.replace(/@LoginUID@/ig, `'${sessionStorage.getItem('LoginUID')}'`) + sql = sql.replace(/@SessionUid@/ig, `'${localStorage.getItem('SessionUid')}'`) + sql = sql.replace(/@UserID@/ig, `'${sessionStorage.getItem('UserID')}'`) + sql = sql.replace(/@Appkey@/ig, `'${window.GLOB.appkey}'`) + // sql = sql.replace(/@datam@/ig, `''`) + if (window.GLOB.externalDatabase !== null) { sql = sql.replace(/@db@/ig, window.GLOB.externalDatabase) } @@ -1075,7 +1136,7 @@ sql = sql.replace(/\n/ig, ' ') - param.LText = Utils.formatOptions(sql) + param.LText = Utils.formatOptions(sql, param.exec_type) param.secretkey = Utils.encrypt('', param.timestamp) param = this.encryptParam(param) -- Gitblit v1.8.0