StatisticLogic_test.go 956 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. package test
  2. import (
  3. "git.rtzhtech.cn/iss/public-lib/dto"
  4. "git.rtzhtech.cn/iss/public-lib/logic"
  5. "testing"
  6. "time"
  7. )
  8. func TestTime(t *testing.T) {
  9. ts := time.Now().AddDate(0, 0, -1).Format("2006-01-02 00:00:00")
  10. timeLayout := "2006-01-02 15:04:05"
  11. loc, _ := time.LoadLocation("Local") //获取时区
  12. theTime, _ := time.ParseInLocation(timeLayout, ts, loc) //使用模板在对应时区转化为time.time类型
  13. t.Log(theTime.Unix())
  14. tt := time.Now().Format("2006-01-02 00:00:00")
  15. t.Log(tt)
  16. }
  17. func TestGetStatisticInfo(t *testing.T) {
  18. server := logic.NewStatisticsLogic()
  19. req := new(dto.GetStatisticInfoRequest)
  20. req.AppId = 1
  21. cont, err := server.GetStatisticInfo(req)
  22. if err != nil {
  23. t.Error(err)
  24. }
  25. t.Log(cont)
  26. }
  27. func TestGetDevStatus(t *testing.T) {
  28. server := logic.NewStatisticsLogic()
  29. req := new(dto.GetDevStatusRequest)
  30. resp, err := server.GetDevStatus(req)
  31. if err != nil {
  32. t.Error(err)
  33. }
  34. t.Log(resp)
  35. }