feat: 支持每周任务重置和查询
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful

This commit is contained in:
xinian
2026-03-05 14:56:28 +08:00
committed by cnb
parent 10e1126cd7
commit 2259093790
4 changed files with 61 additions and 19 deletions

View File

@@ -24,16 +24,16 @@ func NewTaskService() *TaskService {
}
}
func (s *TaskService) Get(id, os int) *model.TaskConfig {
var item []model.TaskConfig
dbm_enable(s.Model).Where("task_id", id).Scan(&item)
var res *model.TaskConfig
for _, v := range item {
if v.OutState == os {
res = &v
dbm_enable(s.Model).Where("task_id", id).Where("out_state", os).Scan(res)
// var res *model.TaskConfig
// for _, v := range item {
// if v.OutState == os {
// res = &v
}
// }
}
// }
return res
@@ -44,6 +44,25 @@ func (s *TaskService) GetDaily() []model.TaskConfig {
return item
}
func (s *TaskService) GetWeek() []model.TaskConfig {
var item []model.TaskConfig
dbm_enable(s.Model).Where("task_type", 2).Scan(&item)
return item
}
func (s *TaskService) IsDaily(id, os int) bool {
var item *model.TaskConfig
dbm_enable(s.Model).Where("task_id", id).Where("out_state", os).Scan(item)
if item == nil {
return false
}
if item.TaskType == 1 {
return true
}
return false
}
func (s *TaskService) IsAcceptable(taskid uint32) (out *model.TaskConfig) {
@@ -57,4 +76,3 @@ func (s *TaskService) IsAcceptable(taskid uint32) (out *model.TaskConfig) {
return
}