charge.go 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. package http
  2. import (
  3. "go-common/library/log"
  4. bm "go-common/library/net/http/blademaster"
  5. )
  6. func archiveChargeStatis(c *bm.Context) {
  7. v := new(struct {
  8. CategoryID []int64 `form:"category_id,split"`
  9. Type int `form:"type"`
  10. GroupType int `form:"group_type" default:"1"`
  11. FromTime int64 `form:"from_time" validate:"required,min=1"`
  12. ToTime int64 `form:"to_time" validate:"required,min=1"`
  13. })
  14. if err := c.Bind(v); err != nil {
  15. return
  16. }
  17. data, err := incomeSvr.ArchiveChargeStatis(c, v.CategoryID, v.Type, v.GroupType, v.FromTime, v.ToTime)
  18. if err != nil {
  19. log.Error("incomeSvr.ArchiveChargeStatis error(%v)", err)
  20. c.JSON(nil, err)
  21. return
  22. }
  23. c.JSON(data, nil)
  24. }
  25. func archiveChargeSection(c *bm.Context) {
  26. v := new(struct {
  27. CategoryID []int64 `form:"category_id,split"`
  28. Type int `form:"type"`
  29. GroupType int `form:"group_type" default:"1"`
  30. FromTime int64 `form:"from_time" validate:"required,min=1"`
  31. ToTime int64 `form:"to_time" validate:"required,min=1"`
  32. })
  33. if err := c.Bind(v); err != nil {
  34. return
  35. }
  36. data, err := incomeSvr.ArchiveChargeSection(c, v.CategoryID, v.Type, v.GroupType, v.FromTime, v.ToTime)
  37. if err != nil {
  38. log.Error("growup incomeSvr.ArchiveChargeSection error(%v)", err)
  39. c.JSON(nil, err)
  40. return
  41. }
  42. c.JSON(data, nil)
  43. }
  44. func archiveChargeDetail(c *bm.Context) {
  45. v := new(struct {
  46. AID int64 `form:"aid" validate:"required"`
  47. Type int `form:"type"`
  48. })
  49. if err := c.Bind(v); err != nil {
  50. return
  51. }
  52. data, err := incomeSvr.ArchiveChargeDetail(c, v.AID, v.Type)
  53. if err != nil {
  54. log.Error("growup incomeSvr.ArchiveDetail error(%v)", err)
  55. c.JSON(nil, err)
  56. return
  57. }
  58. c.JSON(data, nil)
  59. }
  60. func bgmChargeDetail(c *bm.Context) {
  61. v := new(struct {
  62. SID int64 `form:"sid" validate:"required"`
  63. })
  64. if err := c.Bind(v); err != nil {
  65. return
  66. }
  67. data, err := incomeSvr.BgmChargeDetail(c, v.SID)
  68. if err != nil {
  69. log.Error("growup incomeSvr.BgmChargeDetail error(%v)", err)
  70. c.JSON(nil, err)
  71. return
  72. }
  73. c.JSON(data, nil)
  74. }
  75. func upRatio(c *bm.Context) {
  76. v := new(struct {
  77. From int64 `form:"from"`
  78. Limit int64 `form:"limit" validate:"required"`
  79. })
  80. if err := c.Bind(v); err != nil {
  81. return
  82. }
  83. data, err := incomeSvr.UpRatio(c, v.From, v.Limit)
  84. if err != nil {
  85. log.Error("growup incomeSvr.UpRatio error(%v)", err)
  86. c.JSON(nil, err)
  87. return
  88. }
  89. c.JSON(data, nil)
  90. }