fix db bugs
Former-commit-id: 55a997bc7669f4b207da153a3fdd1cb3b1b2935d
This commit is contained in:
parent
5ecf478439
commit
ce0d5a9b32
|
@ -80,8 +80,6 @@ func (l *PageListTaskLogic) PageListTask(req *types.PageTaskReq) (resp *types.Pa
|
||||||
for _, ch := range chs {
|
for _, ch := range chs {
|
||||||
select {
|
select {
|
||||||
case <-ch:
|
case <-ch:
|
||||||
case <-time.After(2 * time.Second):
|
|
||||||
return
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
|
@ -107,6 +105,26 @@ func (l *PageListTaskLogic) updateTaskStatus(tasks []*types.TaskModel, ch chan<-
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if len(aiTask) == 1 {
|
||||||
|
task.Status = aiTask[0].Status
|
||||||
|
task.StartTime = aiTask[0].StartTime
|
||||||
|
task.EndTime = aiTask[0].EndTime
|
||||||
|
tx = l.svcCtx.DbEngin.Model(&types.TaskModel{}).Table("task")
|
||||||
|
tx = tx.Where("deleted_at is null")
|
||||||
|
tx = tx.Updates(task)
|
||||||
|
if tx.Error != nil {
|
||||||
|
logx.Errorf(tx.Error.Error())
|
||||||
|
return
|
||||||
|
}
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
for i := len(aiTask) - 1; i >= 0; i-- {
|
||||||
|
if aiTask[i].StartTime == "" {
|
||||||
|
aiTask = append(aiTask[:i], aiTask[i+1:]...)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
start, _ := time.ParseInLocation(constants.Layout, aiTask[0].StartTime, time.Local)
|
start, _ := time.ParseInLocation(constants.Layout, aiTask[0].StartTime, time.Local)
|
||||||
end, _ := time.ParseInLocation(constants.Layout, aiTask[0].EndTime, time.Local)
|
end, _ := time.ParseInLocation(constants.Layout, aiTask[0].EndTime, time.Local)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue