Пример #1
0
 @RequestMapping(value = "/template/setIndustry", method = RequestMethod.GET)
 public Map<String, String> setIndustry() {
   Industry industry = new Industry();
   industry.industry_id1 = Industry.EDUCATION_TRAINING;
   industry.industry_id2 = Industry.BUSINESS_AGENT;
   client.setIndustry(industry);
   return MapUtil.createMap("result", "ok");
 }
Пример #2
0
 @RequestMapping(value = "/hello", method = RequestMethod.GET)
 public Object sendMessageByTemplate(
     @RequestParam("templateId") String templateId, @RequestParam("to") String to) {
   String accessToken = client.getAccessToken();
   Map<String, Object> data =
       MapUtil.createMap(
           "touser",
           to,
           "template_id",
           templateId,
           "url",
           "http://weixin.qq.com/download/",
           "topcolor",
           "#FF0000",
           "data",
           MapUtil.createMap("user", MapUtil.createMap("value", "Mr兔子", "color", "#FF0000")));
   return client.postJson(
       Map.class, "/message/template/send?access_token=" + HttpUtil.urlEncode(accessToken), data);
 }