package test import ( "git.rtzhtech.cn/iss/public-lib/dto" "git.rtzhtech.cn/iss/public-lib/logic" "testing" "time" ) func TestTime(t *testing.T) { ts := time.Now().AddDate(0, 0, -1).Format("2006-01-02 00:00:00") timeLayout := "2006-01-02 15:04:05" loc, _ := time.LoadLocation("Local") //获取时区 theTime, _ := time.ParseInLocation(timeLayout, ts, loc) //使用模板在对应时区转化为time.time类型 t.Log(theTime.Unix()) tt := time.Now().Format("2006-01-02 00:00:00") t.Log(tt) } func TestGetStatisticInfo(t *testing.T) { server := logic.NewStatisticsLogic() req := new(dto.GetStatisticInfoRequest) req.AppId = 1 cont, err := server.GetStatisticInfo(req) if err != nil { t.Error(err) } t.Log(cont) } func TestGetDevStatus(t *testing.T) { server := logic.NewStatisticsLogic() req := new(dto.GetDevStatusRequest) resp, err := server.GetDevStatus(req) if err != nil { t.Error(err) } t.Log(resp) }