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
f9e65631
Commit
f9e65631
authored
Sep 20, 2019
by
szh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add json
parent
925657cd
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
11 deletions
+21
-11
main.go
main.go
+2
-1
pai.go
service/pai_service/pai.go
+19
-10
No files found.
main.go
View file @
f9e65631
...
...
@@ -101,7 +101,7 @@ func broadcast() {
if
err
!=
nil
{
fmt
.
Println
(
err
)
}
log
.
Println
(
send
)
//
log.Println(send)
time
.
Sleep
(
time
.
Second
)
}
}
\ No newline at end of file
service/pai_service/pai.go
View file @
f9e65631
...
...
@@ -12,18 +12,24 @@ import (
)
type
Pai
struct
{
Hardware
string
Revision
string
Serial
string
Hardware
string
`json:"hardware"`
Revision
string
`json:"revision"`
Serial
string
`json:"serial"`
//PeerList *types.PeerList
LocalLastHeight
int64
LastHeight
int64
IsNtpSync
bool
WalletStatus
*
types
.
WalletStatus
NetInfo
*
types
.
NodeNetInfo
LocalLastHeight
int64
`json:"local_last_height"`
LastHeight
int64
`json:"last_height"`
IsNtpSync
bool
`json:"is_ntp_sync"`
WalletStatus
*
types
.
WalletStatus
`json:"wallet_status"`
NetInfo
*
types
.
NodeNetInfo
`json:"net_info"`
}
var
pai_serial
string
func
(
p
*
Pai
)
GetConfig
()
bool
{
if
pai_serial
!=
""
{
logging
.
Debug
(
"pai_serial"
,
pai_serial
)
p
.
Serial
=
pai_serial
}
if
p
.
Serial
!=
""
{
return
true
}
...
...
@@ -93,15 +99,18 @@ func getPaiConfig(command string ,arg ...string) (config map[string]string,err e
if
err
!=
nil
||
io
.
EOF
==
err
{
break
}
else
{
fmt
.
Println
(
"line"
,
line
)
//
fmt.Println("line", line)
l
:=
strings
.
Split
(
line
,
":"
)
if
len
(
l
)
==
2
{
k
:=
strings
.
ToLower
(
strings
.
TrimRight
(
strings
.
Trim
(
strings
.
Replace
(
l
[
0
],
" "
,
" "
,
-
1
),
" "
),
" "
))
v
:=
strings
.
Trim
(
strings
.
Replace
(
l
[
1
],
"
\n
"
,
""
,
-
1
),
" "
)
fmt
.
Println
(
"KEY:"
,
k
,
"VAL:"
,
v
)
//
fmt.Println("KEY:",k, "VAL:", v)
if
_
,
ok
:=
list
[
k
];
!
ok
{
list
[
k
]
=
v
if
k
==
"serial"
{
pai_serial
=
v
}
}
}
}
...
...
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