private User register(String nickName, String photoPath) {
    if (StringUtil.isEmptyOrNull(nickName)) {
      throw new IllegalArgumentException();
    }

    long userId = userDao.getId();
    User user = new User();
    user.setPhotoPath(photoPath);
    user.setNickName(nickName + userId);
    user.setAddTime(new Date());
    user.setUserId(userId);
    return this.addUser(user);
  }
  @Override
  public User register(String account, String password, String nick) throws ServiceException {
    if (StringUtil.isEmptyOrNull(password) || StringUtil.isEmptyOrNull(nick)) {
      throw new IllegalArgumentException();
    }

    if (!StringUtil.isEmptyOrNull(account)) {
      // 验证账号格式
      if (!StringUtil.match(account, "^\\w{5,50}$")) {
        throw new ServiceException(ErrService.UserS.ACC_105, "账号:“" + account + "”格式错误。");
      }
      account = account.toLowerCase();
      // 验证账号是否重复
      if (this.verifyAccountRep(account)) {
        throw new ServiceException(ErrService.UserS.ACC_101, "账号:“" + account + "”已经被使用。");
      }
    }

    // 验证昵称格式
    if (!StringUtil.match(nick, "^.{1,12}$")) {
      throw new ServiceException(ErrService.UserS.ACC_106, "昵称:“" + nick + "”格式错误。");
    }
    // 验证密码格式
    if (!StringUtil.match(password, "^.{6,20}$")) {
      throw new ServiceException(ErrService.UserS.ACC_107, "密码:“" + password + "”格式错误。");
    }
    // 验证昵称是否重复
    if (this.verifyNickRep(nick)) {
      throw new ServiceException(ErrService.UserS.ACC_102, "昵称:“" + nick + "”已经被使用。");
    }

    User user = new User();
    user.setAccount(account);
    // 加密处理
    password = PasswordMD.md5(password);
    user.setPassword(password);
    user.setNickName(nick);
    user.setAddTime(new Date());
    return this.addUser(user);
  }