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
786f85c6
Commit
786f85c6
authored
Sep 05, 2024
by
贾浩@五瓣科技
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix
parent
80f21fb7
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
2 deletions
+2
-2
db.go
dao/db.go
+2
-2
No files found.
dao/db.go
View file @
786f85c6
...
@@ -160,7 +160,7 @@ func (d *Dao) CreateTaskHistory(taskId int, userId string, isDailyTask bool) (ex
...
@@ -160,7 +160,7 @@ func (d *Dao) CreateTaskHistory(taskId int, userId string, isDailyTask bool) (ex
temp
:=
make
([]
*
dbModel
.
TaskHistory
,
0
)
temp
:=
make
([]
*
dbModel
.
TaskHistory
,
0
)
if
!
isDailyTask
{
if
!
isDailyTask
{
err
=
tx
.
Set
(
"gorm:query_option"
,
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
{
if
err
==
gorm
.
ErrRecordNotFound
{
err
=
tx
.
Create
(
&
dbModel
.
TaskHistory
{
err
=
tx
.
Create
(
&
dbModel
.
TaskHistory
{
Id
:
util
.
GenFlakeID
(),
Id
:
util
.
GenFlakeID
(),
...
@@ -175,7 +175,7 @@ func (d *Dao) CreateTaskHistory(taskId int, userId string, isDailyTask bool) (ex
...
@@ -175,7 +175,7 @@ func (d *Dao) CreateTaskHistory(taskId int, userId string, isDailyTask bool) (ex
return
err
==
nil
,
err
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
{
if
err
==
gorm
.
ErrRecordNotFound
{
err
=
tx
.
Create
(
&
dbModel
.
TaskHistory
{
err
=
tx
.
Create
(
&
dbModel
.
TaskHistory
{
Id
:
util
.
GenFlakeID
(),
Id
:
util
.
GenFlakeID
(),
...
...
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