timeSliceQueryPush
This commit is contained in:
parent
4847e4eced
commit
540d873eac
|
|
@ -25,7 +25,11 @@ func timeSliceQueryPush(startTime, endTime time.Time, duration time.Duration, re
|
|||
|
||||
// 每指定间隔时间发送一次请求
|
||||
for t := startTime; t.Before(endTime); t = t.Add(duration) {
|
||||
|
||||
end := t.Add(duration) // 计算每次请求的结束时间
|
||||
if end.After(endTime) {
|
||||
end = endTime
|
||||
}
|
||||
|
||||
// 创建请求体
|
||||
requestBody := map[string]any{
|
||||
|
|
@ -60,7 +64,11 @@ func pushWechatQuery(startTime, endTime time.Time, duration time.Duration, reque
|
|||
|
||||
// 每指定间隔时间发送一次请求
|
||||
for t := startTime; t.Before(endTime); t = t.Add(duration) {
|
||||
|
||||
end := t.Add(duration) // 计算每次请求的结束时间
|
||||
if end.After(endTime) {
|
||||
end = endTime
|
||||
}
|
||||
|
||||
// 创建请求体
|
||||
requestBody := map[string]any{
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ func Test_script(t *testing.T) {
|
|||
return
|
||||
}
|
||||
|
||||
endTime, err := time.Parse(time.DateTime, "2025-05-01 2:00:03")
|
||||
endTime, err := time.Parse(time.DateTime, "2025-05-01 02:00:03")
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
|
|
|
|||
Loading…
Reference in New Issue