コード例 #1
0
 /** 去关注回复页面 */
 @RequestMapping(value = "/goSubscribe")
 public ModelAndView goSubscribe() {
   logBefore(logger, "去关注回复页面");
   ModelAndView mv = this.getModelAndView();
   PageData pd = new PageData();
   pd = this.getPageData();
   try {
     pd.put("KEYWORD", "关注");
     PageData msgpd = weixinTextMsgService.findByKw(pd);
     if (null != msgpd) {
       mv.addObject("msg", "文本消息");
       mv.addObject("content", msgpd.getString("CONTENT"));
     } else {
       msgpd = weixinImgMsgService.findByKw(pd);
       if (null != msgpd) {
         mv.addObject("msg", "图文消息");
         mv.addObject("content", "标题:" + msgpd.getString("TITLE1"));
       } else {
         msgpd = weixinCommandService.findByKw(pd);
         if (null != msgpd) {
           mv.addObject("msg", "命令");
           mv.addObject("content", "执行命令:" + msgpd.getString("COMMANDCODE"));
         } else {
           mv.addObject("msg", "无回复");
         }
       }
     }
     mv.setViewName("weixin/subscribe");
     mv.addObject("pd", msgpd);
   } catch (Exception e) {
     logger.error(e.toString(), e);
   }
   return mv;
 }
コード例 #2
0
 /** 判断关键词是否存在 */
 @RequestMapping(value = "/hasK")
 @ResponseBody
 public Object hasK() {
   Map<String, String> map = new HashMap<String, String>();
   String errInfo = "success";
   PageData pd = new PageData();
   try {
     pd = this.getPageData();
     pd.put("STATUS", "3");
     if (weixinTextMsgService.findByKw(pd) != null
         || weixinCommandService.findByKw(pd) != null
         || weixinImgMsgService.findByKw(pd) != null) {
       errInfo = "error";
     }
   } catch (Exception e) {
     logger.error(e.toString(), e);
   }
   map.put("result", errInfo); // 返回结果
   return AppUtil.returnObject(new PageData(), map);
 }