public void init() { if (dao.count(ForumTip.class) < 1) { ForumTip forumTip = new ForumTip(); forumTip.setUid(1); forumTip.setContent("第一条测试信息--论坛信息"); forumTip.setCreateTime(System.currentTimeMillis()); dao.insert(forumTip); } }
@At("/f/newTip") public boolean newTip(@Param("content") String content, HttpSession session) { if (Strings.isBlank(content)) return false; AuthUserInfo authUserInfo = (AuthUserInfo) session.getAttribute(AuthUserInfo.class.getName()); if (authUserInfo == null) return false; ForumTip forumTip = new ForumTip(); forumTip.setAuthUserInfo(authUserInfo); forumTip.setUid(authUserInfo.getUid()); forumTip.setContent(content); forumTip.setCreateTime(System.currentTimeMillis()); dao.insert(forumTip); return true; }