route.go 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. // Copyright 2019 github.com. All rights reserved.
  2. // Use of this source code is governed by github.com.
  3. package route
  4. import (
  5. "net/http"
  6. "property-callback-gateway/controller/v1"
  7. "github.com/gin-gonic/gin"
  8. _ "property-callback-gateway/docs"
  9. )
  10. func SetupRoute(engine *gin.Engine) {
  11. // 404页面
  12. engine.NoRoute(func(c *gin.Context) {
  13. c.String(http.StatusNotFound, "Not Found")
  14. })
  15. c := v1.NewController()
  16. // 服务健康检查
  17. engine.GET("/ping", func(c *gin.Context) {
  18. // TODO 心跳检查
  19. c.String(http.StatusOK, "pong")
  20. })
  21. //engine.Use(middleware.Session("smart-site-supplier"))
  22. // version 1
  23. apiv1 := engine.Group("/api/v1")
  24. {
  25. wx := apiv1.Group("wx")
  26. {
  27. applet := wx.Group("/applet")
  28. {
  29. applet.POST("/pay_callback", c.WxMiniPayCallback)
  30. applet.POST("/pay_callbackv3", c.WxMiniPayCallbackv3)
  31. }
  32. public := wx.Group("/public")
  33. {
  34. public.GET("", c.WxPublicIn)
  35. public.POST("", c.WxPublicCallback)
  36. }
  37. }
  38. }
  39. apisv1 := engine.Group("/apis/v1")
  40. {
  41. wx := apisv1.Group("wx")
  42. {
  43. applet := wx.Group("/applet")
  44. {
  45. applet.POST("/pay_callbackv3", c.WxMiniPayCallbackv3)
  46. }
  47. }
  48. }
  49. }