pay.go 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248
  1. package controller
  2. import (
  3. "bet24.com/servers/adminserver/shop"
  4. "net/http"
  5. "bet24.com/log"
  6. "bet24.com/servers/adminserver/dao"
  7. "github.com/gin-gonic/gin"
  8. coreClient "bet24.com/servers/coreservice/client"
  9. )
  10. // 订单列表
  11. func OrderList(c *gin.Context) {
  12. obj := dao.NewOrderList()
  13. if err := c.ShouldBind(&obj.In); err != nil {
  14. log.Debug("%s shouldBind err %v", "orderList", err)
  15. return
  16. }
  17. obj.DoAction(nil)
  18. for i, v := range obj.Out.List {
  19. productName := shop.GetProductFormatStr(v.ProductID)
  20. if len(productName) <= 0 {
  21. continue
  22. }
  23. obj.Out.List[i].ProductName = productName
  24. }
  25. c.JSON(http.StatusOK, obj.Out)
  26. return
  27. }
  28. // 获取各渠道充值列表
  29. func PayList(c *gin.Context) {
  30. obj := dao.NewPayList()
  31. if err := c.ShouldBind(&obj.In); err != nil {
  32. log.Debug("%s shouldBind err %v", "payList", err)
  33. return
  34. }
  35. obj.DoAction(nil)
  36. c.JSON(http.StatusOK, obj.Out)
  37. return
  38. }
  39. // 充值统计列表
  40. func PayStatList(c *gin.Context) {
  41. obj := dao.NewPayStatList()
  42. if err := c.ShouldBind(&obj.In); err != nil {
  43. log.Debug("%s shouldBind err %v", "payStatList", err)
  44. return
  45. }
  46. obj.DoAction(nil)
  47. c.JSON(http.StatusOK, obj.Out)
  48. return
  49. }
  50. // 登录渠道充值统计
  51. func PayListByPartner(c *gin.Context) {
  52. obj := dao.NewPayListByPartner()
  53. if err := c.ShouldBind(&obj.In); err != nil {
  54. log.Debug("%s shouldBind err %v", "payListByPartner", err)
  55. return
  56. }
  57. obj.DoAction(nil)
  58. c.JSON(http.StatusOK, obj.Out)
  59. return
  60. }
  61. // 日充值总额
  62. func PayListByDay(c *gin.Context) {
  63. obj := dao.NewPayListByDay()
  64. if err := c.ShouldBind(&obj.In); err != nil {
  65. log.Debug("%s shouldBind err %v", "payListByDay", err)
  66. return
  67. }
  68. obj.DoAction(nil)
  69. c.JSON(http.StatusOK, obj.Out)
  70. return
  71. }
  72. // 充值日志
  73. func PayLog(c *gin.Context) {
  74. obj := dao.NewPayLog()
  75. if err := c.ShouldBind(&obj.In); err != nil {
  76. log.Debug("%s shouldBind err %v", "payLog", err)
  77. return
  78. }
  79. obj.DoAction(nil)
  80. for i, v := range obj.Out.List {
  81. productName := shop.GetProductFormatStr(v.ProductID)
  82. if len(productName) <= 0 {
  83. continue
  84. }
  85. obj.Out.List[i].ProductName = productName
  86. }
  87. c.JSON(http.StatusOK, obj.Out)
  88. return
  89. }
  90. // 充值排行
  91. func PayRank(c *gin.Context) {
  92. obj := dao.NewPayRank()
  93. if err := c.ShouldBind(&obj.In); err != nil {
  94. log.Debug("%s shouldBind err %v", "payRank", err)
  95. return
  96. }
  97. obj.DoAction(nil)
  98. c.JSON(http.StatusOK, obj.Out)
  99. return
  100. }
  101. // 苹果日志
  102. func AppleLog(c *gin.Context) {
  103. obj := dao.NewAppleLog()
  104. if err := c.ShouldBind(&obj.In); err != nil {
  105. log.Debug("%s shouldBind err %v", "appleLog", err)
  106. return
  107. }
  108. obj.DoAction(nil)
  109. c.JSON(http.StatusOK, obj.Out)
  110. return
  111. }
  112. // 苹果错误日志
  113. func AppleErrorLog(c *gin.Context) {
  114. obj := dao.NewAppleErrorLog()
  115. if err := c.ShouldBind(&obj.In); err != nil {
  116. log.Debug("%s shouldBind err %v", "appleErrorLog", err)
  117. return
  118. }
  119. obj.DoAction(nil)
  120. c.JSON(http.StatusOK, obj.Out)
  121. return
  122. }
  123. // Google日志
  124. func GoogleLog(c *gin.Context) {
  125. obj := dao.NewGoogleLog()
  126. if err := c.ShouldBind(&obj.In); err != nil {
  127. log.Debug("%s shouldBind err %v", "appleErrorLog", err)
  128. return
  129. }
  130. obj.DoAction()
  131. for i, v := range obj.Out.List {
  132. productName := shop.GetProductFormatStr(v.ProductID)
  133. if len(productName) <= 0 {
  134. continue
  135. }
  136. obj.Out.List[i].ProductName = productName
  137. }
  138. c.JSON(http.StatusOK, obj.Out)
  139. return
  140. }
  141. // 手动充值
  142. func ManualPay(c *gin.Context) {
  143. obj := dao.NewManualPay()
  144. if err := c.ShouldBind(&obj.In); err != nil {
  145. log.Debug("%s shouldBind err %v", "manualPay", err)
  146. return
  147. }
  148. obj.DoAction()
  149. if obj.Out.RetCode == 1 {
  150. // 充值
  151. resp := coreClient.Recharge(obj.In.UserID, obj.In.ProductID)
  152. log.Debug("%s 充值成功 %+v", "manualPay", resp)
  153. }
  154. c.JSON(http.StatusOK, obj.Out)
  155. return
  156. }
  157. // 手动充值列表
  158. func ManualPayList(c *gin.Context) {
  159. obj := dao.NewManualPayList()
  160. if err := c.ShouldBind(&obj.In); err != nil {
  161. log.Debug("%s shouldBind err %v", "manualPayList", err)
  162. return
  163. }
  164. obj.DoAction()
  165. for i, v := range obj.Out.List {
  166. productName := shop.GetProductFormatStr(v.ProductID)
  167. if len(productName) <= 0 {
  168. continue
  169. }
  170. obj.Out.List[i].ProductName = productName
  171. }
  172. c.JSON(http.StatusOK, obj.Out)
  173. return
  174. }
  175. // 充值日志
  176. func PayChipLog(c *gin.Context) {
  177. obj := dao.NewPayChipLog()
  178. if err := c.ShouldBind(&obj.In); err != nil {
  179. log.Debug("%s shouldBind err %v", "PayChipLog", err)
  180. return
  181. }
  182. obj.DoAction(nil)
  183. for i, v := range obj.Out.List {
  184. productName := shop.GetProductFormatStr(v.ProductID)
  185. if len(productName) <= 0 {
  186. continue
  187. }
  188. obj.Out.List[i].ProductName = productName
  189. }
  190. c.JSON(http.StatusOK, obj.Out)
  191. return
  192. }
  193. // 日充值总额
  194. func PayChipListByDay(c *gin.Context) {
  195. obj := dao.NewPayChipListByDay()
  196. if err := c.ShouldBind(&obj.In); err != nil {
  197. log.Debug("%s shouldBind err %v", "PayChipListByDay", err)
  198. return
  199. }
  200. obj.DoAction(nil)
  201. c.JSON(http.StatusOK, obj.Out)
  202. return
  203. }
  204. // 付费用户列表
  205. func PayUserList(c *gin.Context) {
  206. obj := dao.NewPayUserList()
  207. if err := c.ShouldBind(&obj.In); err != nil {
  208. log.Debug("%s shouldBind err %v", "PayUserList", err)
  209. return
  210. }
  211. obj.DoAction()
  212. c.JSON(http.StatusOK, obj.Out)
  213. return
  214. }