|
@@ -290,27 +290,21 @@ public class WechatMsgSendServiceImpl implements IWechatMsgSendService {
|
|
|
String accessToken = getAccessToken();
|
|
String accessToken = getAccessToken();
|
|
|
log.info("获取的token = {}",accessToken);
|
|
log.info("获取的token = {}",accessToken);
|
|
|
String url = weChatProperties.getUrlScheme()+accessToken;
|
|
String url = weChatProperties.getUrlScheme()+accessToken;
|
|
|
- //查询是否还有缓存
|
|
|
|
|
- BoundValueOperations<String, String> ops = redisTemplate.boundValueOps("URL_Scheme");
|
|
|
|
|
- //缓存时长
|
|
|
|
|
- if (StringUtils.isBlank(ops.get())) {
|
|
|
|
|
- JSONObject body = new JSONObject();
|
|
|
|
|
- JSONObject jumpWxa = new JSONObject();
|
|
|
|
|
- jumpWxa.put("path","/pages/earlyWarningManage/earlyWarningDetail");
|
|
|
|
|
- jumpWxa.put("query","id="+id);
|
|
|
|
|
- body.put("jump_wxa", jumpWxa);
|
|
|
|
|
- String respData = HttpUtil.post(url,JSON.toJSONString(body));
|
|
|
|
|
- log.info("UrlScheme 返回参数=====》{}", respData);
|
|
|
|
|
- JSONObject json = JSON.parseObject(respData);
|
|
|
|
|
- if (json.getInteger("errcode") == 0) {
|
|
|
|
|
- String openlink = json.getString("openlink");
|
|
|
|
|
- ops.set(json.getString("openlink"));
|
|
|
|
|
- ops.expire(7100, TimeUnit.SECONDS);
|
|
|
|
|
- return openlink;
|
|
|
|
|
- }
|
|
|
|
|
- log.info("调用微信未生成URL_Scheme");
|
|
|
|
|
- return "";
|
|
|
|
|
|
|
+ JSONObject body = new JSONObject();
|
|
|
|
|
+ JSONObject jumpWxa = new JSONObject();
|
|
|
|
|
+ jumpWxa.put("path","/pages/earlyWarningManage/earlyWarningDetail");
|
|
|
|
|
+ jumpWxa.put("query","id="+id);
|
|
|
|
|
+ body.put("jump_wxa", jumpWxa);
|
|
|
|
|
+ body.put("expire_type", "1");
|
|
|
|
|
+ body.put("expire_interval", "30");
|
|
|
|
|
+ String respData = HttpUtil.post(url,JSON.toJSONString(body));
|
|
|
|
|
+ log.info("UrlScheme 返回参数=====》{}", respData);
|
|
|
|
|
+ JSONObject json = JSON.parseObject(respData);
|
|
|
|
|
+ if (json.getInteger("errcode") == 0) {
|
|
|
|
|
+ String openlink = json.getString("openlink");
|
|
|
|
|
+ return openlink;
|
|
|
}
|
|
}
|
|
|
- return ops.get();
|
|
|
|
|
|
|
+ log.info("生成openlink失败!");
|
|
|
|
|
+ return "";
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|