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
61acebbc
Commit
61acebbc
authored
Dec 10, 2019
by
ligaishun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Delete pai_latest.txt
parent
077ec185
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
78 deletions
+0
-78
pai_latest.txt
routers/api/v1/pai_latest.txt
+0
-78
No files found.
routers/api/v1/pai_latest.txt
deleted
100644 → 0
View file @
077ec185
package v1
import (
"os"
"path"
"os/exec"
"strings"
"net/http"
"chain33-pai/pkg/e"
"chain33-pai/pkg/app"
"github.com/gin-gonic/gin"
"chain33-pai/service/pai_service"
)
func GetDevdetail(c *gin.Context) {
appG := app.Gin{C: c}
var pai pai_service.Pai
ok := pai.GetConfig()
if !ok {
appG.Response(http.StatusOK, e.ERROR, nil)
}
appG.Response(http.StatusOK, e.SUCCESS, map[string]interface{}{
"serial": pai.Serial,
})
}
func GetDevstatus(c *gin.Context) {
appG := app.Gin{C: c}
var pai pai_service.Pai
err := pai.GetDevstatus()
if err != nil {
appG.Response(http.StatusOK, e.ERROR, nil)
}
appG.Response(http.StatusOK, e.SUCCESS, pai)
}
func ResetWallet(c *gin.Context) {
appG := app.Gin{C: c}
buffer:=app.GetProcessInfo("wallet.db")
if buffer.String()==""{
appG.Response(http.StatusInternalServerError, e.ERROR, gin.H{
"info":"node is not running",
})
return
}
record:=app.StrFilter(strings.Split(buffer.String()," "))
wallet:=app.ProcessInfo{
PName:record[0],
Pid: record[1],
User: record[2],
Path: path.Dir(path.Dir(record[8])),
}
cmd:=exec.Command("kill","-9",wallet.Pid)
err:=cmd.Start()
if err!=nil{
appG.Response(http.StatusInternalServerError, e.ERROR, gin.H{
"info":"failed to reset wallet",
})
return
}
err=os.RemoveAll(wallet.Path)
if err!=nil{
appG.Response(http.StatusInternalServerError, e.ERROR, gin.H{
"info":"failed to reset wallet",
})
return
}
cmd=exec.Command(path.Dir( wallet.Path)+"/"+wallet.PName)
err=cmd.Start()
if err!=nil{
appG.Response(http.StatusInternalServerError, e.ERROR, gin.H{
"info":"failed to restart node",
})
return
}
appG.Response(http.StatusOK, e.SUCCESS,nil)
}
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