微信公众号分享小图标没有了的原因,终极解决方案

1、从http升级了https 之后出现的问题;

原因:原来的方法,得到的url还是http的,导致微信签名错误:63002,改成下面的代码,签名一致,就可以了

 protected String currentUrl() {
        HttpServletRequest request = ((ServletRequestAttributes)RequestContextHolder.getRequestAttributes()).getRequest();
        String path = request.getRequestURL() + "";
        if (request.getQueryString() != null) {
            path = path + "?" + request.getQueryString();
        }

        String environmentType = Global.getConfig("environment_type");
        if ("prod".equals(environmentType)) {
            path = path.replace("http://", "https://");
        }

        return path.replace(":80", "");
    }

  

www.beicaiduo.com
原文地址:https://www.cnblogs.com/hoge66/p/11880726.html