@RequestMapping(value = "/user/follow") public void followUser( String fuid, String r, HttpServletRequest request, HttpServletResponse response) { String uid = WebUtil.getLoginCookie(request); this.userService.createRelationship( Integer.parseInt(uid), Integer.parseInt(fuid), UserRelations.FOLLOW, null); if ("1".equals(r)) { // 喜欢关系 this.userService.createRelationship( Integer.parseInt(uid), Integer.parseInt(fuid), UserRelations.LOVE, null); } }
/** * 列表页 * * @param request * @param response */ @RequestMapping(value = "/user/list") public String list( String page, String size, HttpServletRequest request, HttpServletResponse response) { String uid = WebUtil.getLoginCookie(request); if (uid == null || "".equals(uid)) { return "/pages/user/login.jsp"; } UserInfo user; try { user = this.userService.getUserInfoById(Integer.parseInt(uid)); Map<String, Feed> feeds = this.feedService.getUserFeed( user.getId(), null, null, Integer.parseInt(page), Integer.parseInt(size), null); Collection<FeedView> fvCollection = new ArrayList<FeedView>(feeds.size()); for (Feed feed : feeds.values()) { if (feed != null) { fvCollection.add(this.feedViewBuilder(feed)); } } request.setAttribute("feeds", fvCollection); request.setAttribute("user", user); return "/pages/user/list.jsp"; } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } return "/pages/user/login.jsp"; }