scope.go 652 B

123456789101112131415161718192021222324252627282930313233
  1. package apis
  2. import (
  3. "go-admin/app/observe/service"
  4. "go-admin/app/observe/service/dto"
  5. "go-admin/utils"
  6. "time"
  7. "github.com/gin-gonic/gin"
  8. )
  9. type WeaveScope struct {
  10. utils.OtApi
  11. }
  12. // GetPage 获取OtUrlMapping列表
  13. func (e WeaveScope) GetMenu(c *gin.Context) {
  14. req := dto.ScopeMenuResp{}
  15. svc := service.WeaveScope{}
  16. if err := e.Init(c, &req, &svc.OtService); err != nil {
  17. return
  18. }
  19. if req.EndTime == 0 {
  20. req.EndTime = time.Now().Unix()
  21. }
  22. if req.StartTime == 0 {
  23. req.StartTime = req.EndTime - 3600
  24. }
  25. e.Context.Writer.Header().Set("Content-Type", "application/json")
  26. e.Context.Writer.Write([]byte(svc.GetMenu(&req)))
  27. return
  28. }