feat: 支持每周任务重置和查询
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful
This commit is contained in:
@@ -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
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user