优化逻辑

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

@@ -0,0 +1,21 @@
package standby_ctrl
import (
"context"
"game-driver/internal/common"
"go.uber.org/zap"
)
func Device(d *common.Device, lock bool, play func(c context.Context) error) func(c context.Context) error {
return func(c context.Context) error {
if lock {
zap.S().Infoln("待机任务锁定设备")
defer zap.S().Infoln("待机任务解锁设备")
d.Lock()
defer d.Unlock()
}
return play(c)
}
}