Esempio n. 1
0
func (this *DataController) All() {
	emotions, err := models.GetAllEmotions("", "", true)
	if err != nil {
		beego.Info(err)
		return
	}

	jsonStruct := make(map[string][]*models.Emotion)
	jsonStruct["data"] = emotions

	this.Data["json"] = jsonStruct
	this.ServeJson()
}
Esempio n. 2
0
func (this *MyEmotionController) Get() {
	if !checkAccount(this.Ctx) {
		this.Redirect("/login", 302)
		return
	}
	this.Data["IsMy"] = true
	this.Data["IsLogin"] = checkAccount(this.Ctx)

	uname := currentUser(this.Ctx)
	emotions, err := models.GetAllEmotions(uname, "", true)
	if err != nil {
		beego.Error(err)
	}
	this.Data["Emotions"] = emotions
	this.TplNames = "my.html"
}