http.go 1015 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. package http
  2. import (
  3. "go-common/app/service/main/history/conf"
  4. "go-common/app/service/main/history/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. srv *service.Service
  11. vfy *verify.Verify
  12. )
  13. // Init init
  14. func Init(c *conf.Config, svc *service.Service) {
  15. srv = svc
  16. vfy = verify.New(c.Verify)
  17. engine := bm.DefaultServer(c.BM)
  18. interRouter(engine)
  19. if err := engine.Start(); err != nil {
  20. log.Error("engine.Start error(%v)", err)
  21. panic(err)
  22. }
  23. }
  24. func interRouter(e *bm.Engine) {
  25. e.Ping(ping)
  26. e.Register(register)
  27. g := e.Group("/x/internal/history", vfy.Verify)
  28. {
  29. g.POST("/add", add)
  30. g.POST("/add/multi", addHistories)
  31. g.POST("/del", del)
  32. g.POST("/clear", clear)
  33. g.GET("/user", userHistories)
  34. g.GET("/aids", histories)
  35. g.GET("/hide", userHide)
  36. g.POST("/hide/update", updateHide)
  37. }
  38. }
  39. func ping(c *bm.Context) {
  40. }
  41. func register(c *bm.Context) {
  42. c.JSON(map[string]interface{}{}, nil)
  43. }