Skip to content

Instantly share code, notes, and snippets.

@freewind
Created November 25, 2011 12:33
Show Gist options
  • Save freewind/1393422 to your computer and use it in GitHub Desktop.
Save freewind/1393422 to your computer and use it in GitHub Desktop.
/**
* 首页。
*/
public static void index() {
// 用于首页中各列表板块取最新文章
Category categoryMail = Category.getByCode("MAIL"); // 校友来函
Category categoryFengcai = Category.getByCode("FENGCAI"); // 校友风采
Category categoryJuanzeng = Category.getByCode("JUANZENG"); // 校友捐赠(文章)
Category categoryService = Category.getByCode("SERVICE"); // 校友服务
Category categoryNotice = Category.getByCode("NOTICE"); // 通知公告
Category categoryNews = Category.getByCode("NEWS"); // 校友新闻
Category categoryHuodong = Category.getByCode("PARTY"); // 校友活动
Category categoryXiaoyouhui = Category.getByCode("XIAOYOUHUI"); // 校友会
Category categoryFenhui = Category.getByCode("FENHUI"); // 校友分会
Category categoryZonghui = Category.getByCode("ZONGHUI"); // 校友总会
Category categoryBooks = Category.getByCode("BOOKS"); // 校友刊物
Category categoryLinks = Category.getByCode("LINKS"); // 友情链接
// 最新留言信息
List<GuestMessage> guestMessages = GuestMessage.find().orderBy("createdAt desc").setMaxRows(6).findList();
// 最新创建的班级
List<Ban> newBanList = Ban.find().orderBy("createdAt desc").setMaxRows(5).findList();
// 最新加入班级信息
List<BanUserR> newAddToClass = BanUserR.find().where().eq("valid", true).orderBy("createdAt desc").setMaxRows(5).findList();
// 最新捐赠信息
List<Donate> donates = Donate.find().where().orderBy("createdAt desc").setMaxRows(50).findList();
// 当前用户收到的站内信
User current = current();
int newMessageCount = 0;
if (current != null) {
newMessageCount = SiteMessage.find().where().eq("to", current).eq("read", false).findRowCount();
}
// 传给view
render(categoryMail, categoryFengcai, categoryJuanzeng, categoryService, categoryNotice,
categoryNews, categoryBooks, categoryLinks,
newBanList, newAddToClass, categoryHuodong, categoryXiaoyouhui, categoryZonghui,
categoryFenhui, newMessageCount, guestMessages, donates);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment