- 首页 > 生活百科 > >
result.setMessage("该二维码已经失效,请重新获取"); } else { if (StringUtils.isNotEmpty(id) && StringUtils.isNotEmpty(token)) { //根据id和token查询后台,获取用户信息userBean String redisToken = redisUtil.getRedis(RedisKeyConstant.APP_TOKEN+userId); if(redisToken != null && redisToken.equals(token)){ UserBean userBean = userService.findByUserId(Long.valueOf(userId)); if (userBean != null) { String sessionId = SessionConstant.SESSION_ID_PRE + FormatUtils.password(userBean.getId() .toString()); Map<String, String> cookieSession = new HashMap<String, String>(); cookieSession .put(CookieConstant.SESSION_KEY, sessionId); // WrCookie.writeCookie(getResponse(),cookieSession); // 添加用户信息到redis boolean re = redisUtil.addUserInfo( RedisKeyConstant.SESSION + sessionId, BeanUtils.toBean(userBean, UserInfo.class)); getSession().setAttribute( SessionConstant.USER_INFO_WEB, BeanUtils.toBean(userBean, UserInfo.class)); getSession().setAttribute( DomainConstant.USER_CENTER_KEY, DomainConstant.USER_CENTER); pool.setSession(sessionId); pool.scanSuccess(); }else{ result = DataResultInfo.getInstance().failure(); result.setMessage("用户信息获取异常!请稍后再试"); } } else { result = DataResultInfo.getInstance().failure(); result.setExtension("11", "用户身份信息失效,请重新登录!");
推荐阅读