zhangqian
2023-11-01 530fed8ec225453572d57b15c200ab062c335457
pkg/contextx/contextx.go
@@ -41,7 +41,8 @@
   // validate params
   if params != nil {
      if err := r.ctx.ShouldBind(params); err != nil {
         r.Fail(ecode.ParamsErr)
         logx.Errorf("bind param error: %v", err.Error())
         r.FailWithMsg(ecode.ParamsErr, err.Error())
         return
      }
   }
@@ -83,6 +84,10 @@
   slf.Result(errCode, map[string]interface{}{}, ecode.GetMsg(errCode))
}
func (slf *Context) FailWithMsg(errCode int, msg string) {
   slf.Result(errCode, map[string]interface{}{}, msg)
}
func (slf *Context) FailWithDetailed(errCode int, data interface{}) {
   slf.Result(errCode, data, ecode.GetMsg(errCode))
}