Commit be64f451811c08efcdb3ca8f59335182e743e527

Authored by shiyang
1 parent 6af6d46453
Exists in master

update

Showing 1 changed file with 12 additions and 7 deletions

talkonlineweb/src/main/java/com/lyms/talkonlineweb/util/WeiXinUtil.java View file @ be64f45
... ... @@ -101,14 +101,19 @@
101 101 paramMap.put("miniprogram", miniprogram);
102 102 paramMap.put("data", dataMap);
103 103 // 接口地址
104   - String sendMsgApi = "https://api.weixin.qq.com/cgi-bin/message/template/send?access_token="+AccessTokenServlet.accessToken;
105   - String result= repeatDoGetPost(sendMsgApi,"POST",paramMap);
106   - if(StringUtil.isEmpty(result)){
107   - return null;
  104 +// boolean TokenValid=true;
  105 + while (true) {
  106 + String sendMsgApi = "https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=" + AccessTokenServlet.accessToken;
  107 + String result = repeatDoGetPost(sendMsgApi, "POST", paramMap);
  108 + if (StringUtil.isEmpty(result)) {
  109 + return null;
  110 + }
  111 + Map<String, Object> resultMap = JSON.parseObject(result, HashMap.class);
  112 + Integer code=Integer.parseInt(resultMap.get("errcode").toString());
  113 + if(!code.equals(40001)){
  114 + return code;
  115 + }
108 116 }
109   - Map<String,Object> resultMap = JSON.parseObject(result, HashMap.class);
110   - return Integer.parseInt(resultMap.get("errcode").toString());
111   -
112 117 }
113 118  
114 119 /**