route.go 920 B

1234567891011121314151617181920212223242526272829303132333435363738
  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-device-gateway/controller/v1"
  7. "github.com/gin-gonic/gin"
  8. _ "property-device-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. // version
  17. api := engine.Group("/api")
  18. {
  19. api.POST("/CheckCode", c.CodeGateCheckCode)
  20. api.POST("/IsConnect", c.CodeGateIsConnect)
  21. api.POST("/QueryCmd", c.CodeGateQueryCmd)
  22. api.POST("/QueryCmdPostData", c.CodeGateQueryCmdPostData)
  23. yufan := engine.Group("/yufan")
  24. yufan.POST("/heartbeat", c.YuFanHeartBeat)
  25. yufan.POST("/task", c.YuFanTaskGet)
  26. yufan.POST("/task_result", c.YuFanTaskResult)
  27. yufan.POST("/result", c.YuFanResultCallback)
  28. yufan.POST("/qcode", c.YufanQcodeCallback)
  29. }
  30. }