// @router /channel/add/ [get] func (this *ChannelController) Add() { name := this.GetString("name") code := this.GetString("code") if name == "" || code == "" { this.Ctx.WriteString("params isn't empty!") return } channel := models.Channel{Name: name, Code: code} err := channel.Insert() if err != nil { this.Ctx.WriteString(err.Error()) } else { this.Ctx.WriteString("success") } }