Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
taskcenter
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Odysseus
taskcenter
Commits
61d7f32e
Commit
61d7f32e
authored
Sep 09, 2024
by
贾浩@五瓣科技
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update retry task
parent
c28c8944
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
2 deletions
+9
-2
db.go
dao/db.go
+9
-2
No files found.
dao/db.go
View file @
61d7f32e
...
@@ -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
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment