http.go 838 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. package http
  2. import (
  3. "go-common/app/service/main/ugcpay-rank/internal/conf"
  4. "go-common/app/service/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/verify"
  8. )
  9. var (
  10. svc *service.Service
  11. verifyM *verify.Verify
  12. )
  13. // Init init
  14. func Init(s *service.Service) {
  15. svc = s
  16. verifyM = verify.New(conf.Conf.Verify)
  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(func(ctx *bm.Context) {})
  26. g := e.Group("/x/internal/ugcpay-rank")
  27. {
  28. g1 := g.Group("/elec", verifyM.Verify)
  29. {
  30. g1.GET("/month/up", elecMonthUP)
  31. g1.GET("/month", elecMonth)
  32. g1.GET("/all/av", elecAllAV)
  33. }
  34. }
  35. }