Exemplo n.º 1
0
 @RequestMapping(value = "/validate.do")
 @ResponseBody
 public AjaxJson validate(String telephone) { // 验证手机号码
   AjaxJson j = new AjaxJson();
   String message = WechatConstant.validate_failed; // 验证失败时候提示
   try {
     if (wechatRegisterServiceImpl.validateRegisterBytel(telephone)) {
       message = WechatConstant.validate_success; // 验证成功时候提供
       j.setObj(GZipUtils.gzip_compress(telephone));
       j.setSuccess(true);
     } else {
       j.setObj(GZipUtils.gzip_compress(WechatConstant.validate_failure));
       j.setSuccess(false);
     }
   } catch (Exception e) {
     e.printStackTrace();
   }
   j.setMsg(message);
   return j;
 }
Exemplo n.º 2
0
 @RequestMapping(value = "/share.do")
 public ModelAndView share(
     HttpServletRequest request, String openId) { // 普通朋友圈分享入口,从这里进入页面必须验证手机号码
   int count = 0;
   try {
     if (openId == null) { // 从朋友圈中进入
       request.setAttribute("telephone", GZipUtils.gzip_compress(WechatConstant.validate_none));
     } else {
       RegisterEntity register = wechatRegisterServiceImpl.findRegisterInfoByOpenId(openId);
       if (register == null) {
         return new ModelAndView("register/error"); // 非法操作,修改了指定路径
       } else {
         request.setAttribute(
             "telephone", GZipUtils.gzip_compress(register.getTelephone())); // 从自己微信端口进入
       }
     }
     count = wechatRegisterServiceImpl.getRegisterNums();
   } catch (Exception e) {
     e.printStackTrace();
   }
   request.setAttribute("regCount", count);
   return new ModelAndView("/register/share");
 }
Exemplo n.º 3
0
 // 登记号后直接进入
 @RequestMapping(value = "/shareWe.do")
 public ModelAndView shareWe(HttpServletRequest request) {
   String openId =
       (String) request.getSession().getAttribute(WechatConstant.register_session_openId);
   int count = 0;
   try {
     if (openId == null) {
       return new ModelAndView("register/error");
     } else {
       RegisterEntity register = wechatRegisterServiceImpl.findRegisterInfoByOpenId(openId);
       request.setAttribute("telephone", GZipUtils.gzip_compress(register.getTelephone()));
     }
     count = wechatRegisterServiceImpl.getRegisterNums();
   } catch (Exception e) {
     e.printStackTrace();
   }
   request.setAttribute("regCount", count);
   return new ModelAndView("/register/share");
 }