package controllers import ( "Kya_New/enums" "fmt" ) type BaseAPIController struct { BaseController } func (this *BaseAPIController) ServeSuccessJSON(data map[string]interface{}) { this.Data["json"] = enums.MakeSuccessResponseJSON(data) this.ServeJSON() } func (this *BaseAPIController) ServeFailJSONWithSGJErrorCode(code int) { this.Data["json"] = enums.MakeFailResponseJSONWithSGJErrorCode(code) this.ServeJSON() } func (this *BaseAPIController) ServeFailJSONWithSGJError(err *enums.SGJError) { this.Data["json"] = enums.MakeFailResponseJSONWithSGJError(err) this.ServeJSON() } func (this *BaseAPIController) ServeFailJsonSend(code int, msg string) { fmt.Println("code", code) this.Data["json"] = enums.MakeFailResponseJSON(msg, code) this.ServeJSON() } type BaseAuthAPIController struct { BaseAPIController } type BaseServeAPIController struct { BaseAPIController } func (this *BaseServeAPIController) Prepare() { this.BaseAPIController.Prepare() }