team_controllger.go 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. package guess
  2. import (
  3. "bet24.com/log"
  4. "github.com/gin-gonic/gin"
  5. "net/http"
  6. )
  7. // 获取球队列表
  8. func GetGuessTeamList(c *gin.Context) {
  9. obj := NewGetGuessTeamList()
  10. obj.Out.List = mgr.getGuessTeamList()
  11. c.JSON(http.StatusOK, obj.Out)
  12. return
  13. }
  14. // 添加球队
  15. func AddGuessTeam(c *gin.Context) {
  16. obj := NewAddGuessTeam()
  17. if err := c.ShouldBind(&obj.In); err != nil {
  18. log.Debug("%s shouldBind err %v", "AddGuessTeam", err)
  19. return
  20. }
  21. obj.Out.Data = mgr.addGuessTeam(obj.In)
  22. c.JSON(http.StatusOK, obj.Out.Data)
  23. return
  24. }
  25. // 获取球队信息
  26. func GetGuessTeamInfo(c *gin.Context) {
  27. obj := NewGetGuessTeamInfo()
  28. if err := c.ShouldBind(&obj.In); err != nil {
  29. log.Debug("%s shouldBind err %v", "GetGuessTeamInfo", err)
  30. return
  31. }
  32. obj.Out.Data, obj.Out.RetCode = mgr.getGuessTeamInfo(obj.In.Id)
  33. c.JSON(http.StatusOK, obj.Out)
  34. return
  35. }
  36. // 编辑球队
  37. func EditGuessTeam(c *gin.Context) {
  38. obj := NewEditGuessTeam()
  39. if err := c.ShouldBind(&obj.In); err != nil {
  40. log.Debug("%s shouldBind err %v", "EditGuessTeam", err)
  41. return
  42. }
  43. obj.Out.Data = mgr.editGuessTeam(obj.In)
  44. c.JSON(http.StatusOK, obj.Out.Data)
  45. return
  46. }