http.go 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. package http
  2. import (
  3. "go-common/app/service/main/assist/conf"
  4. "go-common/app/service/main/assist/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. assSvc *service.Service
  11. verifySvc *verify.Verify
  12. )
  13. // Init init account service.
  14. func Init(c *conf.Config, s *service.Service) {
  15. assSvc = service.New(c)
  16. verifySvc = verify.New(nil)
  17. engineInner := bm.DefaultServer(c.BM)
  18. innerRouter(engineInner)
  19. if err := engineInner.Start(); err != nil {
  20. log.Error("engineInner.Start() error(%v) | config(%v)", err, c)
  21. panic(err)
  22. }
  23. }
  24. // innerRouter init inner router.
  25. func innerRouter(e *bm.Engine) {
  26. e.GET("/monitor/ping", ping)
  27. cr := e.Group("/x/internal/assist", verifySvc.Verify)
  28. {
  29. cr.GET("/assists", assists)
  30. cr.GET("/ups", assistUps)
  31. cr.GET("/stat", assistsMids)
  32. cr.GET("/info", assistInfo)
  33. cr.GET("/ids", assistIDs)
  34. cr.POST("/add", assistAdd)
  35. cr.POST("/del", assistDel)
  36. cr.POST("/exit", assistExit)
  37. cr.GET("/logs", assistLogs)
  38. cr.GET("/log/info", assistLogInfo)
  39. cr.POST("/log/add", assistLogAdd)
  40. cr.POST("/log/cancel", assistLogCancel)
  41. cr.GET("/log/obj", assistLogObj)
  42. }
  43. }