func (this *EventController) Attending() { id, _ := strconv.Atoi(this.Ctx.Input.Param(":id")) t := models.Event{} t.Id = id t.AddAttend() this.Data["json"] = passjson this.ServeJson() }
func (this *EventController) Events() { time, _ := strconv.Atoi(this.Ctx.Input.Param(":time")) t := models.Event{} ts := t.GetAfter(time) response := EventResponse{ts} b, _ := json.Marshal(&response) this.Data["json"] = string(b) this.ServeJson() }
func (this *EventController) Update() { password := this.GetString("password") if password != "ronak123" { this.Data["json"] = failjson this.ServeJson() return } title := this.GetString("title") description := this.GetString("description") t := this.GetString("time") club := this.GetString("club") location := this.GetString("location") lastmod := int(time.Now().Unix()) event := models.Event{} event.Title = title event.Description = description event.Club = club event.Location = location tim, _ := strconv.Atoi(t) event.Time = tim event.Lastmod = lastmod _, status := event.UpdateByTitle() if status != true { this.Data["json"] = failjson this.ServeJson() return } else { this.Data["json"] = passjson this.ServeJson() return } }
func (this *EventController) Attend() { t := models.Event{} timenow := time.Now().Unix() attend := t.GetAttendByTime(int(timenow)) for i, _ := range attend { attend[i].Club = "" attend[i].Description = "" attend[i].Title = "" } b, _ := json.Marshal(&attend) this.Data["json"] = string(b) this.ServeJson() }