Commit 61d7f32e authored by 贾浩@五瓣科技's avatar 贾浩@五瓣科技

update retry task

parent c28c8944
...@@ -174,7 +174,10 @@ func (d *Dao) CreateTaskHistory(taskId int, userId string, isDailyTask bool) (ex ...@@ -174,7 +174,10 @@ func (d *Dao) CreateTaskHistory(taskId int, userId string, isDailyTask bool) (ex
} }
// 已存在,更新updated_at字段 // 已存在,更新updated_at字段
if err == nil { if err == nil {
return true, tx.Model(&dbModel.TaskHistory{}).Where("task_id = ? and user_id = ?", taskId, userId).Update("updated_at", time.Now()).Error return true, tx.Model(&dbModel.TaskHistory{}).
Where("task_id = ? and user_id = ?", taskId, userId).
Limit(1).
Updates(map[string]interface{}{"updated_at": time.Now(), "status": constant.TaskHistoryStatusPending}).Error
} }
return err == nil, err return err == nil, err
...@@ -194,7 +197,11 @@ func (d *Dao) CreateTaskHistory(taskId int, userId string, isDailyTask bool) (ex ...@@ -194,7 +197,11 @@ func (d *Dao) CreateTaskHistory(taskId int, userId string, isDailyTask bool) (ex
} }
// 已存在,更新updated_at字段 // 已存在,更新updated_at字段
if err == nil { if err == nil {
return true, tx.Model(&dbModel.TaskHistory{}).Where("task_id = ? and user_id = ? and created_at >= ?", taskId, userId, time.Now().UTC().Truncate(24*time.Hour)).Update("updated_at", time.Now()).Error return true, tx.Model(&dbModel.TaskHistory{}).
Where("task_id = ? and user_id = ? and created_at >= ?", taskId, userId, time.Now().UTC().Truncate(24*time.Hour)).
Limit(1).
Updates(map[string]interface{}{"updated_at": time.Now(), "status": constant.TaskHistoryStatusPending}).
Error
} }
return err == nil, err return err == nil, err
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment