101captain
2022-05-27 84b51d9bfddcc8da58823fde1b322a8168db5cff
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/utlis/WxXCXTempSend.java
@@ -97,7 +97,7 @@
             wxXCXTempSend.redisTemplate.delete(SecurityConstants.APPLETS_ACCESS_TOKEN);//如果过期则删除
             wxXCXTempSend.redisTemplate.delete(SecurityConstants.APPLETS_ACCESS_TOKEN_TIME);//如果过期则删除
         valueOperations.set(SecurityConstants.APPLETS_ACCESS_TOKEN, accessToken);
         valueOperations.set(SecurityConstants.APPLETS_ACCESS_TOKEN, getAppAccessToken());
         valueOperations.set(SecurityConstants.APPLETS_ACCESS_TOKEN_TIME, System.currentTimeMillis() + 1100000 + "");
         }else{
         accessToken = valueOperations.get(SecurityConstants.APPLETS_ACCESS_TOKEN);
@@ -113,18 +113,8 @@
    public String getAppAccessToken() throws Exception {
        String accessToken = "0";
        try {
            // 此处APP_ID APP_SECRET 在微信小程序后端可见
            // String accessTokenUrl = String.format(TEMP_URL, APP_ID, APP_SECRET);
            String appId = getAppId();
            String appSecret = getAppSecret();
            if(StringUtils.isEmpty(appId)){
                appId = APP_ID;
            }
            if(StringUtils.isEmpty(appSecret)){
                appSecret = APP_SECRET;
            }
            log.info("获取微信token参数:appid=" + appId + ",appSecret=" + appSecret);
            String accessTokenUrl = ACCESS_TOKEN_URL + "&appid=" + appId + "&secret=" + appSecret;
            log.info("获取微信token参数:appid=" + APP_ID + ",appSecret=" + APP_SECRET);
            String accessTokenUrl = ACCESS_TOKEN_URL + "&appid=" + APP_ID + "&secret=" + APP_SECRET;
            String result = HttpClientUtil.httpGet(accessTokenUrl, null, null);
            Map<String, Object> resultMap = JSON.parseObject(result, Map.class);
            if (resultMap.containsKey("access_token")) {