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
a3a21b80
Commit
a3a21b80
authored
Dec 13, 2019
by
szh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
更新接口说明
parent
4f50ca9f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
137 additions
and
74 deletions
+137
-74
README.md
README.md
+136
-37
router.go
routers/router.go
+1
-37
No files found.
README.md
View file @
a3a21b80
#树莓派矿机内置程序监控
### Required
## 接口
### 设备序列号 内网接口
-
Mysql
URL /pai/devdetail
请求方法 post json
|参数|类型|是否必填|说明|
|-|-|-|-|
### Ready
```
response
{
"code":200,
"msg":"",
"data":{
"serial":"",//设备唯一序列号
}
}
```
### 设备节点状态 内网接口
URL /pai/devstatus
请求方法 post json
|参数|类型|是否必填|说明|
|-|-|-|-|
Create a
**blog database**
and import
[
SQL
](
docs/sql/raspberry.sql
)
```
response
{
"code": 200,
"msg": "ok",
"data": {
"hardware": "",
"revision": "",
"serial": "",
"local_last_height": 3819890,
"last_height": 3819890,
"is_ntp_sync": true,
"wallet_status": null,
"net_info": {
"externaladdr": "122.225.230.10:13802",
"localaddr": "192.168.100.139:13802",
"outbounds": 25
}
}
}
```
###
Conf
###
查看版本 内网接口
You should modify
`conf/app.ini`
URL /pai/version
请求方法 post json
|参数|类型|是否必填|说明|
|-|-|-|-|
```
[database]
Type = mysql
User = root
Password =
Host = 127.0.0.1:3306
Name = blog
TablePrefix = blog_
[redis]
Host = 127.0.0.1:6379
Password =
MaxIdle = 30
MaxActive = 30
IdleTimeout = 200
...
response
{
"code": 200,
"msg": "ok",
"data": {
"current": "6.3.2",
"latest": "6.3.2"
}
}
```
### Run
### 查看节点是否在运行 内网接口
URL /pai/nodeinfo
请求方法 post json
|参数|类型|是否必填|说明|
|-|-|-|-|
```
response
{
"code": 200,
"msg": "ok",
"data": "node is running"
}
```
$ cd $GOPATH/src/chain33-pai
$ go run main.go
### 查看节点更新及重置进度 内网接口
URL /pai/updatedetail
请求方法 post json
|参数|类型|是否必填|说明|
|-|-|-|-|
```
response
{
"code": 200,
"msg": "ok",
"data": {
"status": false,
"info": ""
}
}
```
### 重置钱包 内网接口
Project information and existing API
URL /pai/resetwallet
请求方法 post json
|参数|类型|是否必填|说明|
|-|-|-|-|
```
[GIN-debug] [WARNING] Running in "debug" mode. Switch to "release" mode in production.
- using env: export GIN_MODE=release
- using code: gin.SetMode(gin.ReleaseMode)
response
{
"code": 200,
"msg": "ok",
"data": ""
}
```
### 重置节点,一切从新开始从0开始同步节点 内网接口
URL /pai/reset
请求方法 post json
|参数|类型|是否必填|说明|
|-|-|-|-|
[GIN-debug] GET /pai/devdetail --> chain33-pai/routers/api/v1.GetDevdetail (4 handlers)
[GIN-debug] POST /pai/devstatus --> chain33-pai/routers/api/v1.GetDevstatus (4 handlers)
```
response
{
"code": 200,
"msg": "ok",
"data": ""
}
```
### 节点更新到新版本 内网接口
URL /pai/updatenode
请求方法 post json
|参数|类型|是否必填|说明|
|-|-|-|-|
Listening port is 8000
Actual pid is 4393
```
response
{
"code": 200,
"msg": "ok",
"data": ""
}
```
## crontab -l
## 节点部署:
监控程序代码默认放在/home/pi目录下面
钱包节点程序命名为v7-bityuan
默认位置放在/media/pi下面
```
```
crontab
chain33-pai程序自启动
*/1 * * * * /home/pi/chain33-pai/startup.sh
钱包程序自启动
*/1 * * * * /home/pi/chain33-pai/auto.sh >> /home/pi/chain33-pai/auto.log
```
chain33-pai中的auto.sh start.sh 以及startup.sh默认没有执行权限
对应的节点名称修改时应当在配置文件/conf/app.ini中修改bityuan中的Name
节点的挂载盘中应当只有一个对应的启动程序,避免auto.sh去挂载盘上找启动程序时出错
bityuan在github上的配置文件(bityuan.go)变动位置时,需要在对应的本地app.ini中修改VersionPath,节点源代码位置变动也需要更新GitPath
routers/router.go
View file @
a3a21b80
...
...
@@ -12,14 +12,6 @@ func InitRouter() *gin.Engine {
r
.
Use
(
gin
.
Logger
())
r
.
Use
(
gin
.
Recovery
())
//r.StaticFS("/export", http.Dir(export.GetExcelFullPath()))
//r.StaticFS("/upload/images", http.Dir(upload.GetImageFullPath()))
//r.StaticFS("/qrcode", http.Dir(qrcode.GetQrCodeFullPath()))
//r.GET("/auth", api.GetAuth)
//r.GET("/swagger/*any", ginSwagger.WrapHandler(swaggerFiles.Handler))
//r.POST("/upload", api.UploadImage)
apiv1
:=
r
.
Group
(
"/pai"
)
//获取树莓派基本信息
apiv1
.
POST
(
"/devdetail"
,
v1
.
GetDevdetail
)
...
...
@@ -31,35 +23,7 @@ func InitRouter() *gin.Engine {
apiv1
.
POST
(
"/version"
,
v1
.
Version
)
apiv1
.
POST
(
"/reset"
,
v1
.
ResetNode
)
apiv1
.
POST
(
"/nodeinfo"
,
v1
.
NodeInfo
)
//apiv1.Use(jwt.JWT())
//{
//
// //获取标签列表
// apiv1.GET("/tags", v1.GetTags)
// //新建标签
// apiv1.POST("/tags", v1.AddTag)
// //更新指定标签
// apiv1.PUT("/tags/:id", v1.EditTag)
// //删除指定标签
// apiv1.DELETE("/tags/:id", v1.DeleteTag)
// //导出标签
// r.POST("/tags/export", v1.ExportTag)
// //导入标签
// r.POST("/tags/import", v1.ImportTag)
//
// //获取文章列表
// apiv1.GET("/articles", v1.GetArticles)
// //获取指定文章
// apiv1.GET("/articles/:id", v1.GetArticle)
// //新建文章
// apiv1.POST("/articles", v1.AddArticle)
// //更新指定文章
// apiv1.PUT("/articles/:id", v1.EditArticle)
// //删除指定文章
// apiv1.DELETE("/articles/:id", v1.DeleteArticle)
// //生成文章海报
// apiv1.POST("/articles/poster/generate", v1.GenerateArticlePoster)
//}
return
r
}
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