diff --git a/ext.json b/ext.json index 783ffc3..9fcb600 100644 --- a/ext.json +++ b/ext.json @@ -8,10 +8,20 @@ "etcpCallbackUrl": "https://ciformall.youlane.cn/api/carCallback/etcpPaidCallback", "ifHaveWebSocket": "0", "ifHaveCarModular": "1", - "imgOrgUrl": "https://iformall-net.s3.cn-northwest-1.amazonaws.com.cn", - "imgOrgUrl1": "https://s3.cn-northwest-1.amazonaws.com.cn", - "imgNewUrl": "https://ciformall.youlane.cn/img", - "imgNewUrl1": "https://ciformall.youlane.cn/img1" + "imgProxy": [ + { + "orgUrl": "https://iformall-net.s3.cn-northwest-1.amazonaws.com.cn", + "newUrl": "https://ciformall.youlane.cn/img" + }, + { + "orgUrl": "https://s3.cn-northwest-1.amazonaws.com.cn", + "newUrl": "https://ciformall.youlane.cn/img1" + }, + { + "orgUrl": "https://wx.qlogo.cn", + "newUrl": "https://ciformall.youlane.cn/img2" + } + ] }, "name": "富茂客官开发", "weappId": "wxea71200db93d756b", diff --git a/utils/util.js b/utils/util.js index 373748b..382de0b 100644 --- a/utils/util.js +++ b/utils/util.js @@ -2,10 +2,7 @@ var barcode = require("./barcode"); var qrcode = require("./qrcode"); const extConfig = wx.getExtConfigSync ? wx.getExtConfigSync() : {} -let imgOrgUrl = extConfig.attr.imgOrgUrl; -let imgOrgUrl1 = extConfig.attr.imgOrgUrl1; -let imgNewUrl = extConfig.attr.imgNewUrl; -let imgNewUrl1 = extConfig.attr.imgNewUrl1; +let imgProxy = extConfig.attr.imgProxy; const formatTime = (date, fmt) => { try { @@ -155,12 +152,14 @@ function isJSON(str) { } } function getProxyImgUrl(str) { - if (str.indexOf(imgOrgUrl) == 0) { - return str.replace(imgOrgUrl, imgNewUrl) - } else if(str.indexOf(imgOrgUrl1) == 0) { - return str.replace(imgOrgUrl1, imgNewUrl1) - } - return str + let str1 = str; + imgProxy.map(file=>{ + if (str.indexOf(file.orgUrl) == 0) { + str1 = str.replace(file.orgUrl, file.newUrl) + return + } + }) + return str1 } module.exports = { formatTime: formatTime,