Commit 786f85c6 authored by 贾浩@五瓣科技's avatar 贾浩@五瓣科技

fix

parent 80f21fb7
......@@ -160,7 +160,7 @@ func (d *Dao) CreateTaskHistory(taskId int, userId string, isDailyTask bool) (ex
temp := make([]*dbModel.TaskHistory, 0)
if !isDailyTask {
err = tx.Set("gorm:query_option",
"FOR UPDATE").Where("task_id = ? and user_id = ?", taskId, userId).Take(temp).Error
"FOR UPDATE").Where("task_id = ? and user_id = ?", taskId, userId).Take(&temp).Error
if err == gorm.ErrRecordNotFound {
err = tx.Create(&dbModel.TaskHistory{
Id: util.GenFlakeID(),
......@@ -175,7 +175,7 @@ func (d *Dao) CreateTaskHistory(taskId int, userId string, isDailyTask bool) (ex
return err == nil, err
}
err = tx.Set("gorm:query_option", "FOR UPDATE").Where("task_id = ? and user_id = ? and created_at >= ?", taskId, userId, time.Now().UTC().Truncate(24*time.Hour)).Take(temp).Error
err = tx.Set("gorm:query_option", "FOR UPDATE").Where("task_id = ? and user_id = ? and created_at >= ?", taskId, userId, time.Now().UTC().Truncate(24*time.Hour)).Take(&temp).Error
if err == gorm.ErrRecordNotFound {
err = tx.Create(&dbModel.TaskHistory{
Id: util.GenFlakeID(),
......
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