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
329bf80e
Commit
329bf80e
authored
Oct 10, 2019
by
szh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
eddc392b
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
35 additions
and
5 deletions
+35
-5
miner.go
miner/miner.go
+6
-2
pai.go
routers/api/v1/pai.go
+11
-0
router.go
routers/router.go
+1
-3
pai.go
service/pai_service/pai.go
+17
-0
No files found.
miner/miner.go
View file @
329bf80e
...
...
@@ -104,12 +104,16 @@ func SyncBlock() {
}
}
}
err
:=
models
.
UpdateBlocks
(
txsMap
,
statMap
,
processHeight
+
maxDownload
+
1
)
if
len
(
txsList
)
!=
int
(
maxDownload
)
||
len
(
txsList
)
!=
len
(
statList
)
{
logging
.
Error
(
"txsList"
,
len
(
txsList
),
"txsMap"
,
len
(
txsMap
),
"statList"
,
len
(
statList
))
panic
(
"exception txs not eq expect"
)
}
err
:=
models
.
UpdateBlocks
(
txsMap
,
statMap
,
processHeight
+
maxDownload
)
if
err
!=
nil
{
panic
(
err
)
}
prev
.
LocalHeight
+=
prev
.
DownloadHeight
+
1
logging
.
Info
(
"startHeight:"
,
processHeight
,
" endHeight:"
,
processHeight
+
maxDownload
+
1
)
logging
.
Info
(
"startHeight:"
,
processHeight
,
" endHeight:"
,
processHeight
+
maxDownload
)
}
...
...
routers/api/v1/pai.go
View file @
329bf80e
...
...
@@ -29,4 +29,14 @@ func GetDevstatus(c *gin.Context) {
appG
.
Response
(
http
.
StatusOK
,
e
.
ERROR
,
nil
)
}
appG
.
Response
(
http
.
StatusOK
,
e
.
SUCCESS
,
pai
)
}
func
GetTicketInfo
(
c
*
gin
.
Context
)
{
appG
:=
app
.
Gin
{
C
:
c
}
var
pai
pai_service
.
Pai
info
,
err
:=
pai
.
GetTicketInfo
()
if
err
!=
nil
{
appG
.
Response
(
http
.
StatusOK
,
e
.
ERROR
,
nil
)
}
appG
.
Response
(
http
.
StatusOK
,
e
.
SUCCESS
,
info
)
}
\ No newline at end of file
routers/router.go
View file @
329bf80e
...
...
@@ -22,9 +22,7 @@ func InitRouter() *gin.Engine {
apiv1
:=
r
.
Group
(
"/pai"
)
//获取树莓派基本信息
apiv1
.
POST
(
"/devdetail"
,
v1
.
GetDevdetail
)
//获取树莓派基本信息
apiv1
.
POST
(
"/devstatus"
,
v1
.
GetDevstatus
)
apiv1
.
POST
(
"/ticketinfo"
,
v1
.
GetTicketInfo
)
//apiv1.Use(jwt.JWT())
//{
//
...
...
service/pai_service/pai.go
View file @
329bf80e
...
...
@@ -27,6 +27,18 @@ type Pai struct {
NetInfo
*
types
.
NodeNetInfo
`json:"net_info"`
}
type
MinedInfo
struct
{
Mined
int64
`json:"mined"`
Tickets
int64
`json:"tickets"`
MinedList
[]
*
MinedTxInfo
`json:"mined_list"`
}
type
MinedTxInfo
struct
{
Height
int64
`json:"height"`
Amount
int64
`json:"amount"`
BlockTime
int64
`json:"block_time"`
}
func
(
p
*
Pai
)
GetConfig
()
bool
{
if
pai_serial
!=
""
{
p
.
Serial
=
pai_serial
...
...
@@ -124,4 +136,8 @@ func getPaiConfig(command string ,arg ...string) (config map[string]string,err e
}
return
list
,
nil
}
func
(
p
*
Pai
)
GetTicketInfo
()
(
*
MinedInfo
,
error
)
{
return
nil
,
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