Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
chain33-pai
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ligaishun
chain33-pai
Commits
871b5b0a
Commit
871b5b0a
authored
Oct 17, 2019
by
szh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add count
parent
0f9d2196
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
2 deletions
+10
-2
raspMinerTxs.go
models/raspMinerTxs.go
+2
-2
pai.go
service/pai_service/pai.go
+8
-0
No files found.
models/raspMinerTxs.go
View file @
871b5b0a
...
...
@@ -30,8 +30,8 @@ func ExistByAddrHeight(addr string,height int64) (bool, error) {
}
// GetAddrTotal gets the total number of addr based on the constraints
func
GetMinerTxsTotal
(
addr
string
)
(
int
,
error
)
{
var
count
int
func
GetMinerTxsTotal
(
addr
string
)
(
int
64
,
error
)
{
var
count
int
64
if
err
:=
db
.
Model
(
&
RaspMinerTxs
{})
.
Where
(
"miner = ? "
,
addr
)
.
Count
(
&
count
)
.
Error
;
err
!=
nil
{
return
0
,
err
}
...
...
service/pai_service/pai.go
View file @
871b5b0a
...
...
@@ -37,6 +37,7 @@ type MinedInfo struct {
MinerEndTime
int64
`json:"miner_end_time"`
ServeTime
int64
`json:"serve_time"`
MinedList
[]
*
MinedTxInfo
`json:"mined_list"`
MinedTotal
int64
`json:"mined_total"`
}
type
MinedTxInfo
struct
{
...
...
@@ -167,6 +168,10 @@ func (p *Pai) GetTicketInfo(req *ReqTicketInfo) (*MinedInfo,error) {
return
nil
,
err
}
if
req
.
Detail
{
count
,
err
:=
models
.
GetMinerTxsTotal
(
req
.
Addr
)
if
err
!=
nil
{
logging
.
Error
(
"models.GetMinerTxsCount err"
,
err
)
}
txs
,
err
:=
models
.
GetMinerTxs
(
req
.
Page
,
req
.
Pagesize
,
map
[
string
]
interface
{}{
"miner"
:
req
.
Addr
})
if
err
!=
nil
{
logging
.
Error
(
"models.GetAddrs err"
,
err
)
...
...
@@ -180,6 +185,7 @@ func (p *Pai) GetTicketInfo(req *ReqTicketInfo) (*MinedInfo,error) {
t
.
Hash
=
v
.
Hash
txsList
=
append
(
txsList
,
&
t
)
}
info
.
MinedTotal
=
count
}
info
.
MinedAmount
=
stat
.
MinedAmount
info
.
MinedTicketCount
=
stat
.
MinedTicketCount
...
...
@@ -188,5 +194,6 @@ func (p *Pai) GetTicketInfo(req *ReqTicketInfo) (*MinedInfo,error) {
info
.
MinerEndTime
=
stat
.
MinerEndTime
info
.
ServeTime
=
time
.
Now
()
.
Unix
()
info
.
MinedList
=
txsList
return
&
info
,
nil
}
\ No newline at end of file
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