Commit 105ef40ee73f17b59da984bc2c70c2396fab716b

Authored by cfl
1 parent 5d7d952e5e
Exists in master and in 1 other branch dev

部分优化[发送微信消息增加返回日志打印,accesstoken变量增加volatile属性]

Showing 3 changed files with 7 additions and 1 deletions

talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/ChatGroupController.java View file @ 105ef40
... ... @@ -325,6 +325,11 @@
325 325 chatgroup.setHxgroupid(hxgroupid);
326 326 List<LymsChatgroup> cLst = lymsChatgroupService.list(Wrappers.query(chatgroup));
327 327  
  328 + //如果环信有聊天组信息,本地数据库中没有,则不显示(该情况可能是本地测试删除了数据)
  329 + if(CollectionUtils.isEmpty(cLst)){
  330 + continue;
  331 + }
  332 +
328 333 if (cLst.size() > 0) {
329 334 chatgroup = cLst.get(0);
330 335 Map<String, Object> param = new HashMap<>();
talkonlineweb/src/main/java/com/lyms/talkonlineweb/task/AccessTokenServlet.java View file @ 105ef40
... ... @@ -23,7 +23,7 @@
23 23 @Value("${getAccessToken.on_off}")
24 24 public boolean on_off;//配置yml 微信公众号获取access_token(测试环境部署不要开启。会与线上环境冲突)
25 25  
26   - public static String accessToken = null;
  26 + public static volatile String accessToken = null;
27 27  
28 28 /**
29 29 * 启动后开启线程每5分钟获取一次token
talkonlineweb/src/main/java/com/lyms/talkonlineweb/util/WeiXinUtil.java View file @ 105ef40
... ... @@ -111,6 +111,7 @@
111 111 for(int i=0;i<3;i++) {
112 112 String sendMsgApi = "https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=" + AccessTokenServlet.accessToken;
113 113 String result = repeatDoGetPost(sendMsgApi, "POST", paramMap);
  114 + log.info("template push result: {}",result);
114 115 if (StringUtil.isEmpty(result)) {
115 116 break;
116 117 }