优化逻辑
This commit is contained in:
21
internal/routes/standby_ctrl/device.go
Normal file
21
internal/routes/standby_ctrl/device.go
Normal 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)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user