func (this *KindsController) Get() { id, _ := this.GetInt("id") //根据类型获取BBS count, _ := m.GetBBSCount() pager := this.paginator(PAGE_SIZE, count) bbsList, err := m.GetBBSByKindOffset(id, pager.Offset(), PAGE_SIZE) if err != nil { } //获取BBS分类 datas, err := m.GetKindsList() if err != nil { } p := this.GetString("p") if p == "" { p = `1` } this.Data["p"] = p this.Data["bbs"] = bbsList this.Data["id"] = id this.Data["kinds"] = datas this.TplNames = "pageList.html" }
func (this *MainController) Get() { u := this.GetSession("user") if u != nil { usr, ok := u.(m.User) if ok && usr.UserName != "" { this.Data[INFO] = SUCCESS this.Data["user"] = usr } else { this.Data[INFO] = DEFAULT } } else { this.Data[INFO] = DEFAULT } datas, err := m.GetKindsList() if err != nil { } this.Data["kinds"] = datas this.Data["status"] = 0 flash := beego.ReadFromRequest(&this.Controller) if n, ok := flash.Data["notice"]; ok { this.Data["status"], _ = strconv.Atoi(n) } this.TplNames = "index.html" }
//添加帖子 func (this *ContentsList) BBSAdd() { kinds, err := m.GetKindsList() if err != nil { } this.Data["kinds"] = kinds this.Layout = INDEX this.TplNames = "admin/bbsAdd.html" }