order.go 817 B

123456789101112131415161718192021222324252627282930313233343536
  1. package http
  2. import (
  3. "go-common/app/admin/main/vip/model"
  4. "go-common/library/ecode"
  5. bm "go-common/library/net/http/blademaster"
  6. )
  7. func orderList(c *bm.Context) {
  8. arg := new(model.ArgPayOrder)
  9. if err := c.Bind(arg); err != nil {
  10. return
  11. }
  12. res, count, err := vipSvc.OrderList(c, arg)
  13. info := new(model.PageInfo)
  14. info.Count = int(count)
  15. info.Item = res
  16. info.CurrentPage = arg.PN
  17. c.JSON(info, err)
  18. }
  19. func refund(c *bm.Context) {
  20. arg := new(struct {
  21. OrderNo string `form:"order_no" validate:"required"`
  22. RefundAmount float64 `form:"refund_amount" validate:"required"`
  23. })
  24. username, ok := c.Get("username")
  25. if !ok {
  26. c.JSON(nil, ecode.AccessDenied)
  27. return
  28. }
  29. if err := c.Bind(arg); err != nil {
  30. return
  31. }
  32. c.JSON(nil, vipSvc.Refund(c, arg.OrderNo, username.(string), arg.RefundAmount))
  33. }