http.go 997 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. package http
  2. import (
  3. "go-common/app/interface/main/ugcpay-rank/internal/conf"
  4. "go-common/app/interface/main/ugcpay-rank/internal/service"
  5. "go-common/library/log"
  6. bm "go-common/library/net/http/blademaster"
  7. "go-common/library/net/http/blademaster/middleware/auth"
  8. )
  9. var (
  10. svc *service.Service
  11. authM *auth.Auth
  12. )
  13. // Init init
  14. func Init(c *conf.Config, s *service.Service) {
  15. svc = s
  16. authM = auth.New(conf.Conf.Auth)
  17. engine := bm.DefaultServer(conf.Conf.BM)
  18. route(engine)
  19. if err := engine.Start(); err != nil {
  20. log.Error("bm Start error(%v)", err)
  21. panic(err)
  22. }
  23. }
  24. func route(e *bm.Engine) {
  25. e.Ping(ping)
  26. g := e.Group("/x/ugcpay-rank")
  27. {
  28. g1 := g.Group("/v1/elec", authM.GuestMobile)
  29. {
  30. g1.GET("/month/up", elecMonthUP)
  31. g1.GET("/month", elecMonth)
  32. g1.GET("/all/av", elecAllAV)
  33. }
  34. g1 = g.Group("/elec", authM.GuestWeb)
  35. {
  36. g1.GET("/month/up", elecMonthUP)
  37. g1.GET("/month", elecMonth)
  38. g1.GET("/all/av", elecAllAV)
  39. }
  40. }
  41. }
  42. func ping(ctx *bm.Context) {
  43. }