func (this *TopicController) View() { this.TplNames = "topic_view.html" topic, err := models.GetTopic(this.Ctx.Input.Params("0")) if err != nil { beego.Error(err) this.Redirect("/", 302) return } this.Data["Topic"] = topic }
func (this *TopicController) Modify() { this.TplNames = "topic_modify.html" tid := this.Input().Get("tid") topic, err := models.GetTopic(tid) if err != nil { beego.Error(err) this.Redirect("/", 302) return } this.Data["Topic"] = topic this.Data["Tid"] = tid }
func (this *TopicController) Modify() { this.TplNames = "topic_modify.html" this.Data["IsLogin"] = checkAccount(this.Ctx) if !checkAccount(this.Ctx) { this.Redirect("/login", 302) return } tid := this.Input().Get("tid") topic, err := models.GetTopic(tid) if err != nil { beego.Error(err) this.Redirect("/", 302) } this.Data["Topic"] = topic }
func (this *TopicController) View() { this.TplNames = "topic_view.html" tid := this.Ctx.Input.Params("0") topic, err := models.GetTopic(tid) if err != nil { beego.Error(err) this.Redirect("/", 302) return } this.Data["Topic"] = topic replies, err := models.GetAllReplies(tid) if err != nil { beego.Error(err) return } this.Data["Replies"] = replies this.Data["IsLogin"] = checkAccount(this.Ctx) }
func (this *TopicController) View() { this.TplNames = "topic_view.html" reqUrl := this.Ctx.Request.RequestURI i := strings.LastIndex(reqUrl, "/") tid := reqUrl[i+1:] topic, err := models.GetTopic(tid) if err != nil { beego.Error(err) this.Redirect("/", 302) return } this.Data["Topic"] = topic this.Data["Lables"] = strings.Split(topic.Lables, " ") replies, err := models.GetAllReplies(tid) if err != nil { beego.Error(err) return } this.Data["Replies"] = replies this.Data["IsLogin"] = checkAccount(this.Ctx) }