history.go 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. package http
  2. import (
  3. pb "go-common/app/service/main/history/api/grpc"
  4. bm "go-common/library/net/http/blademaster"
  5. "go-common/library/net/http/blademaster/binding"
  6. )
  7. func add(c *bm.Context) {
  8. arg := new(pb.AddHistoryReq)
  9. if err := c.Bind(arg); err != nil {
  10. return
  11. }
  12. c.JSON(srv.AddHistory(c, arg))
  13. }
  14. func addHistories(c *bm.Context) {
  15. arg := new(pb.AddHistoriesReq)
  16. if err := c.BindWith(arg, binding.JSON); err != nil {
  17. return
  18. }
  19. c.JSON(srv.AddHistories(c, arg))
  20. }
  21. func del(c *bm.Context) {
  22. arg := new(pb.DelHistoriesReq)
  23. if err := c.BindWith(arg, binding.JSON); err != nil {
  24. return
  25. }
  26. c.JSON(srv.DelHistories(c, arg))
  27. }
  28. func clear(c *bm.Context) {
  29. arg := new(pb.ClearHistoryReq)
  30. if err := c.Bind(arg); err != nil {
  31. return
  32. }
  33. c.JSON(srv.ClearHistory(c, arg))
  34. }
  35. func userHistories(c *bm.Context) {
  36. arg := new(pb.UserHistoriesReq)
  37. if err := c.Bind(arg); err != nil {
  38. return
  39. }
  40. c.JSON(srv.UserHistories(c, arg))
  41. }
  42. func histories(c *bm.Context) {
  43. arg := new(pb.HistoriesReq)
  44. if err := c.Bind(arg); err != nil {
  45. return
  46. }
  47. c.JSON(srv.Histories(c, arg))
  48. }
  49. func userHide(c *bm.Context) {
  50. arg := new(pb.UserHideReq)
  51. if err := c.Bind(arg); err != nil {
  52. return
  53. }
  54. c.JSON(srv.UserHide(c, arg))
  55. }
  56. func updateHide(c *bm.Context) {
  57. arg := new(pb.UpdateUserHideReq)
  58. if err := c.Bind(arg); err != nil {
  59. return
  60. }
  61. c.JSON(srv.UpdateUserHide(c, arg))
  62. }