settle.go 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. package http
  2. import (
  3. "encoding/json"
  4. "go-common/app/service/openplatform/ticket-sales/model"
  5. bm "go-common/library/net/http/blademaster"
  6. "go-common/library/net/http/blademaster/render"
  7. "net/http"
  8. "go-common/library/net/http/blademaster/binding"
  9. )
  10. func settleCompare(c *bm.Context) {
  11. req := &model.GetSettleOrdersRequest{}
  12. err := json.NewDecoder(c.Request.Body).Decode(&req)
  13. if err != nil {
  14. c.Status(http.StatusBadRequest)
  15. return
  16. }
  17. if err = binding.Form.Bind(c.Request, req); err != nil {
  18. c.Render(http.StatusOK, render.MapJSON{
  19. "errno": 1,
  20. "msg": err.Error(),
  21. })
  22. return
  23. }
  24. data, err := svc.GetSettleOrders(c, req.Date, req.Ref == 1, req.ExtParams, req.PageSize)
  25. if err != nil {
  26. c.Render(http.StatusOK, render.MapJSON{
  27. "errno": 1,
  28. "msg": err.Error(),
  29. })
  30. return
  31. }
  32. c.Render(http.StatusOK, render.MapJSON{
  33. "errno": 0,
  34. "data": data,
  35. })
  36. }
  37. func settleRepush(c *bm.Context) {
  38. var req interface{}
  39. err := json.NewDecoder(c.Request.Body).Decode(&req)
  40. if err != nil {
  41. c.Status(http.StatusBadRequest)
  42. return
  43. }
  44. err = svc.RepushSettleOrders(c, req)
  45. if err != nil {
  46. c.Render(http.StatusOK, render.MapJSON{
  47. "errno": 1,
  48. "msg": err.Error(),
  49. })
  50. }
  51. c.Render(http.StatusOK, render.MapJSON{
  52. "errno": 0,
  53. "msg": "将在5分钟内重推",
  54. })
  55. }