From 62bcedab800c34e33fc7ee67eeef5c8ccb098fde Mon Sep 17 00:00:00 2001 From: yujintao Date: Wed, 18 Sep 2019 11:12:29 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E9=80=9A=E8=BF=87url?= =?UTF-8?q?=E8=8E=B7=E5=8F=96=E9=85=8D=E7=BD=AE=EF=BC=8C=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E5=AF=B9url=E7=9A=84=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../elink/esua/epdc/wx/service/impl/WxServiceImpl.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/wx/service/impl/WxServiceImpl.java b/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/wx/service/impl/WxServiceImpl.java index 803e1c31e..3f17ae773 100644 --- a/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/wx/service/impl/WxServiceImpl.java +++ b/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/wx/service/impl/WxServiceImpl.java @@ -11,6 +11,7 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; + /** * 微信相关服务实现类 * @@ -28,6 +29,15 @@ public class WxServiceImpl implements WxService { @Override public Result getWxConfig(String url) { try { + String httpPrefix = "http://"; + String httpsPrefix = "https://"; + if (url.startsWith(httpPrefix)) { + url = url.replace(httpPrefix, httpsPrefix); + } else if (url.startsWith(httpsPrefix)) { + // 不做处理 + } else { + url = httpsPrefix.concat(url); + } WxJsapiSignature wxJsapiSignature = wxMpService.createJsapiSignature(url); return new Result().ok(wxJsapiSignature); } catch (WxErrorException e) {