|
@@ -480,7 +480,7 @@ public class WeChatServiceImpl implements WeChatService, InitializingBean {
|
|
|
ResponseEntity<String> respStr = restTemplate.exchange(requestUrl,HttpMethod.POST,entity,String.class);
|
|
|
String jsonStr = respStr.getBody();
|
|
|
logger.info("微信设置备注,accountId:{}----end,时间:{},微信返回{}",accountId,LocalDateTime.now().toString(),jsonStr);
|
|
|
- if (0 ==JSONObject.parseObject(jsonStr).getInteger("errcode")) {
|
|
|
+ if (0 ==JSONObject.parseObject(jsonStr).getIntValue("errcode")) {
|
|
|
return fansService.updateFansRemark(accountId,openId,remark);
|
|
|
}
|
|
|
return false;
|
|
@@ -510,4 +510,28 @@ public class WeChatServiceImpl implements WeChatService, InitializingBean {
|
|
|
}
|
|
|
return false;
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public boolean addUserTag(String accountId, List<String> openIds, int wxId) {
|
|
|
+ String requestUrl = "https://api.weixin.qq.com/cgi-bin/tags/members/batchtagging?access_token=%s";
|
|
|
+ String accessToken = getAuthorizerAccessToken(accountId);
|
|
|
+ requestUrl = String.format(requestUrl,accessToken);
|
|
|
+
|
|
|
+ MultiValueMap<String,Object> params = new LinkedMultiValueMap<>(2);
|
|
|
+ HttpHeaders headers = new HttpHeaders();
|
|
|
+ headers.setContentType(MediaType.APPLICATION_JSON);
|
|
|
+ params.add("openid_list",openIds);
|
|
|
+ params.add("tagid",wxId);
|
|
|
+ int size = openIds.size();
|
|
|
+ HttpEntity<MultiValueMap<String, Object>> entity = new HttpEntity<> (params,headers);
|
|
|
+ logger.info("微信用户打标签,accountId:{},opedId size:{}----start,时间:{}",accountId,size, LocalDateTime.now().toString());
|
|
|
+ ResponseEntity<String> respStr = restTemplate.exchange(requestUrl,HttpMethod.POST,entity,String.class);
|
|
|
+ String jsonStr = respStr.getBody();
|
|
|
+ logger.info("微信用户打标签,accountId:{},opedId size:{}----end,时间:{},微信返回:{}",accountId,size, LocalDateTime.now().toString(),jsonStr);
|
|
|
+ if (0 ==JSONObject.parseObject(jsonStr).getIntValue("errcode")) {
|
|
|
+ return tagService.updateTagSize(accountId,wxId,size);
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ }
|
|
|
}
|