http.go 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. package http
  2. import (
  3. "fmt"
  4. "go-common/app/service/main/ugcpay/conf"
  5. "go-common/app/service/main/ugcpay/server/grpc"
  6. "go-common/app/service/main/ugcpay/service"
  7. bm "go-common/library/net/http/blademaster"
  8. "go-common/library/net/http/blademaster/middleware/verify"
  9. )
  10. var (
  11. srv *service.Service
  12. vfy *verify.Verify
  13. )
  14. // Init init
  15. func Init(c *conf.Config, s *service.Service) {
  16. srv = s
  17. vfy = verify.New(c.Verify)
  18. grpc.New(nil, srv)
  19. engine := bm.DefaultServer(c.BM)
  20. route(engine)
  21. if err := engine.Start(); err != nil {
  22. panic(fmt.Sprintf("BM start err(%+v)", err))
  23. }
  24. }
  25. func route(e *bm.Engine) {
  26. e.Ping(ping)
  27. g := e.Group("/x/internal/ugcpay", vfy.Verify)
  28. {
  29. g1 := g.Group("/asset")
  30. {
  31. g1.GET("", assetQuery)
  32. g1.POST("/register", assetRegister)
  33. g1.GET("/relation", assetRelation)
  34. g1.GET("/relation/detail", assetRelationDetail)
  35. }
  36. }
  37. g = e.Group("/x/internal/ugcpay")
  38. {
  39. g1 := g.Group("/trade")
  40. {
  41. g1.POST("refund", vfy.Verify, tradePayRefund)
  42. g1.POST("refunds", vfy.Verify, tradePayRefunds)
  43. g1.GET("/pay/callback", tradePayCallback)
  44. g1.GET("/pay/refund/callback", tradePayRefundCallback)
  45. g1.GET("/pay/recharge/callback", tradePayRechargeCallback)
  46. }
  47. }
  48. }
  49. func ping(c *bm.Context) {
  50. }