common.go 562 B

1234567891011121314151617181920212223242526272829
  1. package http
  2. import (
  3. "go-common/app/admin/main/credit/model/blocked"
  4. bm "go-common/library/net/http/blademaster"
  5. )
  6. func httpData(c *bm.Context, data interface{}, pager *blocked.Pager) {
  7. res := make(map[string]interface{})
  8. if data == nil {
  9. data = struct{}{}
  10. }
  11. if pager == nil {
  12. pager = &blocked.Pager{}
  13. }
  14. res["data"] = data
  15. res["pager"] = &blocked.Pager{
  16. Total: pager.Total,
  17. PN: pager.PN,
  18. PS: pager.PS,
  19. Order: pager.Order,
  20. Sort: pager.Sort,
  21. }
  22. c.JSONMap(res, nil)
  23. }
  24. func httpCode(c *bm.Context, err error) {
  25. c.JSON(nil, err)
  26. }