func PostReplysCount(post *models.Post) { cnt, err := post.Comments().Count() if err == nil { post.Replys = int(cnt) err = post.Update("Replys") } if err != nil { beego.Error("PostReplysCount ", err) } }
func PostReplysCount(post *models.Post) { cnt, err := post.Comments().Count() if err == nil { post.Replys = int(cnt) //disable post editable post.CanEdit = false err = post.Update("Replys", "CanEdit") } if err != nil { beego.Error("PostReplysCount ", err) } }