seat.go 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. package http
  2. import (
  3. "encoding/json"
  4. item "go-common/app/service/openplatform/ticket-item/api/grpc/v1"
  5. "go-common/app/service/openplatform/ticket-item/model"
  6. bm "go-common/library/net/http/blademaster"
  7. "github.com/pkg/errors"
  8. )
  9. // @params SeatInfoParam
  10. // @router post /openplatform/internal/ticket/item/seatInfo
  11. // @response SeatInfoReply
  12. func seatInfo(c *bm.Context) {
  13. arg := new(model.SeatInfoParam)
  14. if err := c.Bind(arg); err != nil {
  15. errors.Wrap(err, "参数验证失败")
  16. return
  17. }
  18. var seats []*item.AreaSeatInfo
  19. json.Unmarshal([]byte(arg.Seats), &seats)
  20. c.JSON(itemSvc.SeatInfo(c, &item.SeatInfoRequest{
  21. Area: arg.Area,
  22. SeatsNum: arg.SeatsNum,
  23. Seats: seats,
  24. Width: arg.Width,
  25. Height: arg.Height,
  26. RowList: arg.RowList,
  27. SeatStart: arg.SeatStart,
  28. }))
  29. }
  30. // @params SeatStockParam
  31. // @router post /openplatform/internal/ticket/item/seatStock
  32. // @response SeatStockReply
  33. func seatStock(c *bm.Context) {
  34. arg := new(model.SeatStockParam)
  35. if err := c.Bind(arg); err != nil {
  36. errors.Wrap(err, "参数验证失败")
  37. return
  38. }
  39. var seatinfo []*item.SeatPrice
  40. json.Unmarshal([]byte(arg.SeatInfo), &seatinfo)
  41. c.JSON(itemSvc.SeatStock(c, &item.SeatStockRequest{
  42. Screen: arg.Screen,
  43. Area: arg.Area,
  44. SeatInfo: seatinfo,
  45. }))
  46. }
  47. // @params RemoveSeatOrdersParam
  48. // @router post /openplatform/internal/ticket/item/RemoveSeatOrders
  49. // @response RemoveSeatOrdersReply
  50. func removeSeatOrders(c *bm.Context) {
  51. arg := new(model.RemoveSeatOrdersParam)
  52. if err := c.Bind(arg); err != nil {
  53. errors.Wrap(err, "参数验证失败")
  54. return
  55. }
  56. c.JSON(itemSvc.RemoveSeatOrders(c, &item.RemoveSeatOrdersRequest{
  57. Price: arg.Price,
  58. }))
  59. }