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
1
Merge Requests
1
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
szh
chain33-pai
Commits
f98712df
Commit
f98712df
authored
Apr 07, 2020
by
szh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
uploadinfo 增加其他信息
parent
385cf171
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
2 deletions
+37
-2
process.go
pkg/app/process.go
+24
-1
pai.go
service/pai_service/pai.go
+13
-1
No files found.
pkg/app/process.go
View file @
f98712df
...
...
@@ -640,18 +640,41 @@ func UploadInfo(tick * time.Ticker) {
for
{
select
{
case
<-
tick
.
C
:
upload
Version
()
upload
Info
()
}
}
}
//上传基本信息
func
uploadInfo
()
error
{
params
:=
make
(
map
[
string
]
interface
{})
params
[
"version"
]
=
GetVersion
()
var
pai
pai_service
.
Pai
err
:=
pai
.
SetPai
()
if
err
!=
nil
{
tlog
.
Error
(
"SetPai"
,
"err"
,
err
)
return
err
}
params
[
"addr"
]
=
pai
.
Serial
params
[
"info"
]
=
pai
data
,
err
:=
json
.
Marshal
(
params
)
client
:=
&
http
.
Client
{}
req
,
err
:=
http
.
NewRequest
(
"POST"
,
setting
.
Chain33Pai
.
UploadVersionUrl
,
bytes
.
NewReader
(
data
))
if
err
!=
nil
{
tlog
.
Error
(
"uploadInfo"
,
"NewRequest"
,
err
)
return
err
}
resp
,
err
:=
client
.
Do
(
req
)
if
err
!=
nil
{
tlog
.
Error
(
"uploadInfo"
,
"NewRequest do"
,
err
)
return
err
}
body
,
err
:=
ioutil
.
ReadAll
(
resp
.
Body
)
if
err
!=
nil
{
tlog
.
Error
(
"uploadInfo"
,
"read"
,
err
)
return
err
}
tlog
.
Info
(
"uploadInfo"
,
"result"
,
string
(
body
))
return
nil
}
...
...
service/pai_service/pai.go
View file @
f98712df
...
...
@@ -30,6 +30,7 @@ type Pai struct {
IsNtpSync
bool
`json:"is_ntp_sync"`
WalletStatus
*
types
.
WalletStatus
`json:"wallet_status"`
NetInfo
*
types
.
NodeNetInfo
`json:"net_info"`
BtyVersion
*
types
.
VersionInfo
`json:"bty_version"`
}
type
ReqUpdatePai
struct
{
...
...
@@ -37,10 +38,21 @@ type ReqUpdatePai struct {
}
func
(
p
*
Pai
)
SetPai
()
error
{
p
.
GetConfig
()
p
.
GetDevstatus
()
p
.
GetBtyVersion
()
return
nil
}
func
(
p
*
Pai
)
GetBtyVersion
()
error
{
client
:=
&
chain33
.
PaiClient
{}
v
,
err
:=
client
.
Version
()
if
err
!=
nil
{
return
err
}
p
.
BtyVersion
=
v
return
nil
}
func
(
p
*
Pai
)
GetConfig
()
bool
{
if
pai_serial
!=
""
{
...
...
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