예제 #1
0
  /**
   * @Description: 会员注册
   *
   * @param @param paramBean
   * @param @param request
   * @param @param response
   * @return void
   * @throws
   * @author Harrisson
   * @date 2015-5-16 下午1:59:10
   */
  @ResponseBody
  @RequestMapping(value = "/UserRegister", method = RequestMethod.POST)
  public void userRegister(
      @RequestBody Member members, HttpServletRequest request, HttpServletResponse response) {
    Map<String, Object> map = new HashMap<String, Object>();

    try {
      map.put("UserName", members.getUsername());
      map.put("Question", members.getQuestion());
      map.put("Answer", members.getAnswer());
      map.put("Password", MD5.MD5(members.getPassword()));
      map.put("memberId", RandomIDUtil.genUUID());
      if (!memberService.checkUserName(members.getUsername())) {

        Member member = memberService.userRegister(map);
        if (member != null) {
          printJsonSingle(SEND_OK, SEND_OK_MSG, member, request, response);
        } else {
          printJsonSingle(SEND_FAIL, "注册失败,请检查注册信息是否正确", null, request, response);
        }
      } else {
        printJsonSingle(SEND_FAIL, "注册失败,该用户名已存在", null, request, response);
      }
    } catch (Exception e) {
      e.printStackTrace();
      try {
        log.error("UserRegister:" + e.getMessage());
        printJsonSingle(SEND_FAIL, CATCH_CHECK, null, request, response);
      } catch (IOException e1) {
      }
    }
  }
예제 #2
0
 /**
  * @Description: 第三方登陆(不实现,屏蔽)
  *
  * @param @param paramBean
  * @param @param request
  * @param @param response
  * @return void
  * @throws
  * @author Harrisson
  * @date 2015-5-16 下午1:43:59
  */
 @ResponseBody
 @RequestMapping(value = "/ExternalLogin", method = RequestMethod.POST)
 public void externalLogin(
     @RequestBody ParamBean paramBean, HttpServletRequest request, HttpServletResponse response) {
   Map<String, Object> map = new HashMap<String, Object>();
   try {
     map.put("OpenId", paramBean.getOpenId());
     map.put("Name", paramBean.getOpenId());
     map.put("Gender", paramBean.getGender());
     map.put("UserForm", paramBean.getUserForm());
     Member member = memberService.externalLogin(map);
     if (member != null) {
       printJsonSingle(SEND_OK, SEND_OK_MSG, member, request, response);
     } else {
       printJsonSingle(SEND_FAIL, "登录失败,请检查账号或密码是否正确", null, request, response);
     }
   } catch (Exception e) {
     e.printStackTrace();
     try {
       log.error("ExternalLogin:" + e.getMessage());
       printJsonSingle(SEND_FAIL, CATCH_CHECK, null, request, response);
     } catch (IOException e1) {
     }
   }
 }
예제 #3
0
  /**
   * @Description: 修改个人基本信息
   *
   * @param @param paramBean
   * @param @param request
   * @param @param response
   * @return void
   * @throws
   */
  @ResponseBody
  @RequestMapping(value = "/ModifyUser", method = RequestMethod.POST)
  public void modifyUser(
      @RequestBody Member member, HttpServletRequest request, HttpServletResponse response) {
    try {
      if (memberService.update(member) > 0) {
        printStringSingle(SEND_OK, SEND_SUCCESS_MSG, "修改成功!", request, response);
      } else {
        printStringSingle(SEND_FAIL, SEND_FAIL_MSG, "修改失败", request, response);
      }
    } catch (Exception e) {
      e.printStackTrace();
      try {
        log.error("UserExists:" + e.getMessage());
        printIntegerSingle(SEND_FAIL, CATCH_CHECK, 0, request, response);
      } catch (IOException e1) {

      }
    }
  }
예제 #4
0
 /**
  * @Description: 账号登陆
  *
  * @param @param paramBean
  * @param @param request
  * @param @param response
  * @return void
  * @throws
  * @author Harrisson
  * @date 2015-5-16 下午1:14:55
  */
 @ResponseBody
 @RequestMapping(value = "/Login", method = RequestMethod.POST)
 public void login(
     @RequestBody Member members, HttpServletRequest request, HttpServletResponse response) {
   Map<String, Object> map = new HashMap<String, Object>();
   try {
     map.put("UserName", members.getUsername());
     map.put("Password", MD5.MD5(members.getPassword()));
     Member member = memberService.login(map);
     if (member != null) {
       printJsonSingle(SEND_OK, SEND_OK_MSG, member, request, response);
     } else {
       printJsonSingle(SEND_FAIL, "登录失败,请检查账号或密码是否正确", null, request, response);
     }
   } catch (Exception e) {
     e.printStackTrace();
     try {
       log.error("Login:" + e.getMessage());
       printJsonSingle(SEND_FAIL, CATCH_CHECK, null, request, response);
     } catch (IOException e1) {
     }
   }
 }