feat(vscode): 添加调试参数配置 为launch.json添加-debug=1参数,便于调试模式启动 docs(README): 补充zellij终端复用工具使用说明 添加x-cmd安装和zellij会话管理相关命令示例 refactor(config): 注释掉GamePort配置项 暂时注释GamePort配置项以解决配置冲突问题 refactor(xmlres): 移除未使用的gf框架依赖并注释文件监控逻辑 移除未使用的gctx、gfile、gfsnotify、glog导入包 注释init函数中的文件监控逻辑,避免不必要的文件监听 ```
70 lines
1.2 KiB
Go
70 lines
1.2 KiB
Go
package service
|
|
|
|
import (
|
|
"blazing/cool"
|
|
"blazing/modules/config/model"
|
|
|
|
"github.com/gogf/gf/v2/database/gdb"
|
|
)
|
|
|
|
type TaskService struct {
|
|
*cool.Service
|
|
}
|
|
|
|
func NewTaskService() *TaskService {
|
|
return &TaskService{
|
|
&cool.Service{
|
|
Model: model.NewTaskConfig(),
|
|
PageQueryOp: &cool.QueryOp{
|
|
FieldEQ: []string{"task_type"},
|
|
},
|
|
//UniqueKey: map[string]string{"task_id": "索引不能重复"},
|
|
},
|
|
}
|
|
}
|
|
func (s *TaskService) Get(id, os uint32) *model.TaskConfig {
|
|
var item []model.TaskConfig
|
|
cool.DBM(s.Model).Where("task_id", id).
|
|
Cache(gdb.CacheOption{
|
|
// Duration: time.Hour,
|
|
|
|
Force: false,
|
|
}).Scan(&item)
|
|
var res *model.TaskConfig
|
|
if len(item) == 1 { //只有一个直接默认
|
|
if item[0].OutState == os {
|
|
res = &item[0]
|
|
}
|
|
if item[0].OutState < 10 {
|
|
res = &item[0]
|
|
}
|
|
|
|
}
|
|
if len(item) > 1 { //
|
|
|
|
for _, v := range item {
|
|
if v.OutState == os {
|
|
res = &item[os]
|
|
return res
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return res
|
|
|
|
}
|
|
func (s *TaskService) GetDaily() []model.TaskConfig {
|
|
var item []model.TaskConfig
|
|
cool.DBM(s.Model).Where("task_type", 1).
|
|
Cache(gdb.CacheOption{
|
|
// Duration: time.Hour,
|
|
|
|
Force: false,
|
|
}).Scan(&item)
|
|
|
|
return item
|
|
|
|
}
|