- 注释掉所有 BlankOpen/BlankClose 调用,启动不再关屏 - 将 xset 路径查找改为 init + sync.Once 缓存,避免重复执行 - 清理未使用的 utils 导入 Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
28 lines
560 B
Go
28 lines
560 B
Go
package play
|
|
|
|
import (
|
|
"game-driver/internal/middleware"
|
|
"game-driver/internal/schema"
|
|
"game-driver/leaf"
|
|
"game-driver/pkg/utils"
|
|
"game-driver/pkg/video"
|
|
|
|
"go.uber.org/zap"
|
|
)
|
|
|
|
func OnlyVideo(c *leaf.Context) {
|
|
payload := leaf.Value[*schema.PlayModal](c, middleware.PayloadJSONKey)
|
|
|
|
// utils.BlankOpen()
|
|
// defer utils.BlankClose()
|
|
|
|
if url, ok := payload.Game["video"]; ok {
|
|
path, local, err := utils.LinkVideo(url.(string))
|
|
if err != nil {
|
|
zap.S().Errorln("视频文件获取异常: ", err)
|
|
return
|
|
}
|
|
_ = video.Play(c, path, local)
|
|
}
|
|
}
|