优化逻辑

This commit is contained in:
2025-03-13 19:18:10 +08:00
parent 7a07f39f1b
commit 4189705922
14 changed files with 185 additions and 37 deletions

View File

@@ -7,7 +7,6 @@ import (
"game-driver/pkg/utils"
"game-driver/pkg/video"
"go.uber.org/zap"
"time"
)
func Video(item schema.WaitItemModel) func(c context.Context) error {
@@ -23,16 +22,10 @@ func Video(item schema.WaitItemModel) func(c context.Context) error {
utils.BlankOpen()
defer utils.BlankClose()
for {
err := video.Play(c, path, local)
if err != nil {
return fmt.Errorf("视频播放异常: %w", err)
}
select {
case <-c.Done():
return nil
case <-time.After(time.Duration(item.Interval) * time.Second):
}
err = video.Play(c, path, local)
if err != nil {
return fmt.Errorf("视频播放异常: %w", err)
}
return nil
}
}