Ver Código Fonte

优化SysService.logn方法

jiapeng 8 anos atrás
pai
commit
63f203505b

+ 5 - 4
src/main/java/com/ekexiu/portal/service/SysService.java

537
	@Post
537
	@Post
538
	@Path("/login")
538
	@Path("/login")
539
	public SessionUser login(@JdbcConn Connection con, String lk, String pw)
539
	public SessionUser login(@JdbcConn Connection con, String lk, String pw)
540
			throws SQLException {
540
			throws SQLException,JfwBaseException {
541
		User user = userDao.queryByEmailOrMobilePhone(con, lk);
541
		User user = userDao.queryByEmailOrMobilePhone(con, lk);
542
		if (null == user)
542
		if (null == user)
543
			throw new SQLException("该用户还未注册");
543
			throw new JfwBaseException(-1,"该用户还未注册");
544
		if (DEFAULT_PASS_WORD.equals(user.getPasswd()))
544
		if (DEFAULT_PASS_WORD.equals(user.getPasswd()))
545
			return null;
545
			return null;
546
		if (!StringUtil.md5(pw).equals(user.getPasswd()))
546
		if (!StringUtil.md5(pw).equals(user.getPasswd()))
548
548
549
		SessionUser ret = new SessionUser();
549
		SessionUser ret = new SessionUser();
550
		ret.setId(user.getId());
550
		ret.setId(user.getId());
551
		if (null != this.professorDao.query(con, user.getId())) {
552
			ret.setName(this.professorDao.query(con, user.getId()).getName());
551
		Professor pf =  this.professorDao.query(con, user.getId());
552
		if (null !=pf) {
553
			ret.setName(pf.getName());
553
		}
554
		}
554
		ret.setMobilePhone(user.getMobilePhone());
555
		ret.setMobilePhone(user.getMobilePhone());
555
		ret.setType(user.getUserType());
556
		ret.setType(user.getUserType());