Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
sdk-api
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
sdk-api
Commits
a8871496
Commit
a8871496
authored
Jul 22, 2024
by
贾浩@五瓣科技
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
5f5a66a6
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
4 deletions
+10
-4
db.go
dao/db.go
+8
-2
executer.go
executor/executer.go
+1
-1
db.go
model/db/db.go
+1
-1
No files found.
dao/db.go
View file @
a8871496
...
@@ -54,10 +54,16 @@ func (d *Dao) CreateTask(task *dbModel.Task) (err error) {
...
@@ -54,10 +54,16 @@ func (d *Dao) CreateTask(task *dbModel.Task) (err error) {
}
}
func
(
d
*
Dao
)
UpdateTaskStatus
(
taskId
,
txHash
string
,
status
int
)
(
err
error
)
{
func
(
d
*
Dao
)
UpdateTaskStatus
(
taskId
,
txHash
string
,
status
int
)
(
err
error
)
{
return
d
.
db
.
Model
(
&
dbModel
.
Task
{})
.
Where
(
"task_id = ?"
,
taskId
)
.
Updates
(
map
[
string
]
interface
{}{
if
taskId
!=
""
{
"tx_hash"
:
txHash
,
return
d
.
db
.
Model
(
&
dbModel
.
Task
{})
.
Where
(
"task_id = ?"
,
taskId
)
.
Updates
(
map
[
string
]
interface
{}{
"tx_hash"
:
txHash
,
"tx_status"
:
status
,
})
.
Error
}
return
d
.
db
.
Model
(
&
dbModel
.
Task
{})
.
Where
(
"tx_hash = ?"
,
txHash
)
.
Updates
(
map
[
string
]
interface
{}{
"tx_status"
:
status
,
"tx_status"
:
status
,
})
.
Error
})
.
Error
}
}
func
(
d
*
Dao
)
GetTxHashesByStatus
(
status
int
)
(
txHashes
[]
string
,
err
error
)
{
func
(
d
*
Dao
)
GetTxHashesByStatus
(
status
int
)
(
txHashes
[]
string
,
err
error
)
{
...
...
executor/executer.go
View file @
a8871496
...
@@ -83,7 +83,7 @@ func (e *Executor) ProcessReceipt(sync bool) {
...
@@ -83,7 +83,7 @@ func (e *Executor) ProcessReceipt(sync bool) {
log
.
WithFields
(
log
.
Fields
{
"txHash"
:
txHash
,
"status"
:
status
})
.
Info
(
"get tx receipt"
)
log
.
WithFields
(
log
.
Fields
{
"txHash"
:
txHash
,
"status"
:
status
})
.
Info
(
"get tx receipt"
)
err
=
e
.
d
.
UpdateTaskStatus
(
txHash
,
txHash
,
status
)
err
=
e
.
d
.
UpdateTaskStatus
(
""
,
txHash
,
status
)
if
err
!=
nil
{
if
err
!=
nil
{
log
.
WithFields
(
log
.
Fields
{
log
.
WithFields
(
log
.
Fields
{
"txHash"
:
txHash
,
"txHash"
:
txHash
,
...
...
model/db/db.go
View file @
a8871496
...
@@ -22,7 +22,7 @@ type Task struct {
...
@@ -22,7 +22,7 @@ type Task struct {
ToAddress
string
`gorm:"type:varchar(255);not null;comment:目标地址"`
ToAddress
string
`gorm:"type:varchar(255);not null;comment:目标地址"`
Value
string
`gorm:"type:varchar(255);not null;comment:金额"`
Value
string
`gorm:"type:varchar(255);not null;comment:金额"`
Calldata
string
`gorm:"type:varchar(2048);not null;comment:参数"`
Calldata
string
`gorm:"type:varchar(2048);not null;comment:参数"`
TxHash
string
`gorm:"type:varchar(255);not null;comment:交易hash"`
TxHash
string
`gorm:"type:varchar(255);
index;
not null;comment:交易hash"`
TxStatus
int
`gorm:"type:int;not null;comment:交易状态"`
TxStatus
int
`gorm:"type:int;not null;comment:交易状态"`
gorm
.
Model
gorm
.
Model
}
}
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