zhangqian
2023-08-15 550bd8a218224e6c73201f444387d66a299f438b
pkg/contextx/contextx.go
@@ -18,6 +18,12 @@
      Data interface{} `json:"data"`
      Msg  string      `json:"msg"`
   }
   ResponseList struct {
      Code  int         `json:"code"`
      Data  interface{} `json:"data"`
      Msg   string      `json:"msg"`
      Total int64       `json:"total"`
   }
)
func NewContext(ctx *gin.Context, params interface{}) (r *Context, isAllow bool) {
@@ -71,6 +77,13 @@
   })
}
func (slf *Context) ResultList(data interface{}, total int64) {
   slf.ctx.JSON(http.StatusOK, ResponseList{
      Data:  data,
      Total: total,
   })
}
func (slf *Context) Ok() {
   slf.Result(ecode.OK, map[string]interface{}{}, "")
}