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
cfec11b1
Commit
cfec11b1
authored
Aug 28, 2020
by
szh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
up
parent
ddd99b81
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
5 deletions
+43
-5
docs.go
docs/docs.go
+0
-0
node.go
routers/api/v1/node.go
+43
-5
No files found.
docs/docs.go
View file @
cfec11b1
This diff is collapsed.
Click to expand it.
routers/api/v1/node.go
View file @
cfec11b1
...
@@ -22,6 +22,13 @@ import (
...
@@ -22,6 +22,13 @@ import (
"chain33-pai/pkg/util"
"chain33-pai/pkg/util"
)
)
// @Summary 重置节点钱包
// @Description 重置节点钱包 无参
// @Accept json
// @Success 200 {object} app.Response
// @Failure 500 {object} app.Response
// @Router /pai/resetwallet [post]
func
ResetWallet
(
c
*
gin
.
Context
)
{
func
ResetWallet
(
c
*
gin
.
Context
)
{
appG
:=
app
.
Gin
{
C
:
c
}
appG
:=
app
.
Gin
{
C
:
c
}
util
.
AddValue
(
&
app
.
JobID
,
1
)
util
.
AddValue
(
&
app
.
JobID
,
1
)
...
@@ -29,9 +36,12 @@ func ResetWallet(c *gin.Context) {
...
@@ -29,9 +36,12 @@ func ResetWallet(c *gin.Context) {
appG
.
Response
(
http
.
StatusOK
,
e
.
SUCCESS
,
app
.
JobID
)
appG
.
Response
(
http
.
StatusOK
,
e
.
SUCCESS
,
app
.
JobID
)
}
}
//钱包更新,只替换执行文件和配置文件
// @Summary 节点手动更新
//具体更新逻辑不再代码实现
// @Description 节点手动更新 无参
//oss下载包打包要保持执行权限
// @Accept json
// @Success 200 {object} app.Response
// @Failure 500 {object} app.Response
// @Router /pai/updatenode [post]
func
UpdateNodeNew
(
c
*
gin
.
Context
)
{
func
UpdateNodeNew
(
c
*
gin
.
Context
)
{
appG
:=
app
.
Gin
{
C
:
c
}
appG
:=
app
.
Gin
{
C
:
c
}
app
.
BityuanFlag
.
Lock
.
Lock
()
app
.
BityuanFlag
.
Lock
.
Lock
()
...
@@ -152,7 +162,12 @@ func UpdateNodeNew(c *gin.Context) {
...
@@ -152,7 +162,12 @@ func UpdateNodeNew(c *gin.Context) {
appG
.
Response
(
http
.
StatusOK
,
e
.
SUCCESS
,
"update job ok"
)
appG
.
Response
(
http
.
StatusOK
,
e
.
SUCCESS
,
"update job ok"
)
}
}
//重置节点只需要删除datadir 然后重启节点
// @Summary 重置节点
// @Description 重置节点 慎用(同步时间长 1周以上)
// @Accept json
// @Success 200 {object} app.Response
// @Failure 500 {object} app.Response
// @Router /pai/reset [post]
func
ResetNode
(
c
*
gin
.
Context
)
{
func
ResetNode
(
c
*
gin
.
Context
)
{
appG
:=
app
.
Gin
{
C
:
c
}
appG
:=
app
.
Gin
{
C
:
c
}
util
.
AddValue
(
&
app
.
JobID
,
1
)
util
.
AddValue
(
&
app
.
JobID
,
1
)
...
@@ -168,7 +183,12 @@ func UpdateDetail(c *gin.Context) {
...
@@ -168,7 +183,12 @@ func UpdateDetail(c *gin.Context) {
})
})
}
}
//get current version and latest version
// @Summary 获取当前版本和最新版本
// @Description 获取当前版本和最新版本
// @Accept json
// @Success 200 {object} app.Response
// @Failure 500 {object} app.Response
// @Router /pai/version [post]
func
Version
(
c
*
gin
.
Context
)
{
func
Version
(
c
*
gin
.
Context
)
{
appG
:=
app
.
Gin
{
C
:
c
}
appG
:=
app
.
Gin
{
C
:
c
}
setting
.
FreshVersion
()
setting
.
FreshVersion
()
...
@@ -187,6 +207,12 @@ func Version(c *gin.Context) {
...
@@ -187,6 +207,12 @@ func Version(c *gin.Context) {
})
})
}
}
// @Summary 获取节点运行状态
// @Description 获取节点运行状态
// @Accept json
// @Success 200 {object} app.Response
// @Failure 500 {object} app.Response
// @Router /pai/nodeinfo [post]
func
NodeInfo
(
c
*
gin
.
Context
)
{
func
NodeInfo
(
c
*
gin
.
Context
)
{
appG
:=
app
.
Gin
{
C
:
c
}
appG
:=
app
.
Gin
{
C
:
c
}
var
client
chain33
.
PaiClient
var
client
chain33
.
PaiClient
...
@@ -198,6 +224,12 @@ func NodeInfo(c *gin.Context) {
...
@@ -198,6 +224,12 @@ func NodeInfo(c *gin.Context) {
appG
.
Response
(
http
.
StatusOK
,
e
.
SUCCESS
,
"node is running"
)
appG
.
Response
(
http
.
StatusOK
,
e
.
SUCCESS
,
"node is running"
)
}
}
// @Summary 重启节点
// @Description 重启节点
// @Accept json
// @Success 200 {object} app.Response
// @Failure 500 {object} app.Response
// @Router /pai/restartnode [post]
func
RestartNode
(
c
*
gin
.
Context
)
{
func
RestartNode
(
c
*
gin
.
Context
)
{
appG
:=
app
.
Gin
{
C
:
c
}
appG
:=
app
.
Gin
{
C
:
c
}
util
.
AddValue
(
&
app
.
JobID
,
1
)
util
.
AddValue
(
&
app
.
JobID
,
1
)
...
@@ -205,6 +237,12 @@ func RestartNode(c *gin.Context) {
...
@@ -205,6 +237,12 @@ func RestartNode(c *gin.Context) {
appG
.
Response
(
http
.
StatusOK
,
e
.
SUCCESS
,
app
.
JobID
)
appG
.
Response
(
http
.
StatusOK
,
e
.
SUCCESS
,
app
.
JobID
)
}
}
// @Summary 关闭节点
// @Description 关闭节点
// @Accept json
// @Success 200 {object} app.Response
// @Failure 500 {object} app.Response
// @Router /pai/closenode [post]
func
CloseNode
(
c
*
gin
.
Context
)
{
func
CloseNode
(
c
*
gin
.
Context
)
{
appG
:=
app
.
Gin
{
C
:
c
}
appG
:=
app
.
Gin
{
C
:
c
}
util
.
AddValue
(
&
app
.
JobID
,
1
)
util
.
AddValue
(
&
app
.
JobID
,
1
)
...
...
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