Commit cfec11b1 authored by szh's avatar szh

up

parent ddd99b81
// GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
// This file was generated by swaggo/swag at
// 2019-02-02 17:46:50.428407 +0800 CST m=+0.087414608
// This file was generated by swaggo/swag
package docs
import (
"bytes"
"encoding/json"
"strings"
"github.com/alecthomas/template"
"github.com/swaggo/swag"
)
var doc = `{
"schemes": {{ marshal .Schemes }},
"swagger": "2.0",
"info": {
"description": "An example of gin",
"title": "Golang Gin API",
"description": "{{.Description}}",
"title": "{{.Title}}",
"termsOfService": "https://chain33-pai",
"contact": {},
"license": {
"name": "MIT",
"url": "https://chain33-pai/blob/master/LICENSE"
},
"version": "1.0"
"version": "{{.Version}}"
},
"host": "{{.Host}}",
"basePath": "{{.BasePath}}",
"paths": {
"/api/v1/articles": {
"get": {
"produces": [
"application/json"
],
"summary": "Get multiple articles",
"parameters": [
{
"description": "TagID",
"name": "tag_id",
"in": "body",
"schema": {
"type": "object"
}
},
{
"description": "State",
"name": "state",
"in": "body",
"schema": {
"type": "object"
}
},
{
"description": "CreatedBy",
"name": "created_by",
"in": "body",
"schema": {
"type": "object"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "object",
"$ref": "#/definitions/app.Response"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"type": "object",
"$ref": "#/definitions/app.Response"
}
}
}
},
"/api/v1/tags/import": {
"post": {
"produces": [
"application/json"
],
"summary": "Add article",
"summary": "Import Image",
"parameters": [
{
"description": "TagID",
"name": "tag_id",
"in": "body",
"required": true,
"schema": {
"type": "object"
}
},
{
"description": "Title",
"name": "title",
"in": "body",
"required": true,
"schema": {
"type": "object"
}
},
{
"description": "Desc",
"name": "desc",
"in": "body",
"required": true,
"schema": {
"type": "object"
}
},
{
"description": "Content",
"name": "content",
"in": "body",
"required": true,
"schema": {
"type": "object"
}
},
{
"description": "CreatedBy",
"name": "created_by",
"in": "body",
"required": true,
"schema": {
"type": "object"
}
},
{
"description": "State",
"name": "state",
"in": "body",
"required": true,
"schema": {
"type": "object"
}
"type": "file",
"description": "Image File",
"name": "image",
"in": "formData",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "object",
"$ref": "#/definitions/app.Response"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"type": "object",
"$ref": "#/definitions/app.Response"
}
}
}
}
},
"/api/v1/articles/{id}": {
"get": {
"produces": [
"application/json"
],
"summary": "Get a single article",
"parameters": [
{
"type": "integer",
"description": "ID",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "object",
"$ref": "#/definitions/app.Response"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"type": "object",
"$ref": "#/definitions/app.Response"
}
}
}
},
"put": {
"produces": [
"application/json"
],
"summary": "Update article",
"parameters": [
{
"type": "integer",
"description": "ID",
"name": "id",
"in": "path",
"required": true
},
{
"description": "TagID",
"name": "tag_id",
"in": "body",
"schema": {
"type": "object"
}
},
{
"description": "Title",
"name": "title",
"in": "body",
"schema": {
"type": "object"
}
},
{
"description": "Desc",
"name": "desc",
"in": "body",
"schema": {
"type": "object"
}
},
{
"description": "Content",
"name": "content",
"in": "body",
"schema": {
"type": "object"
}
},
{
"description": "ModifiedBy",
"name": "modified_by",
"in": "body",
"required": true,
"schema": {
"type": "object"
}
},
{
"description": "State",
"name": "state",
"in": "body",
"schema": {
"type": "object"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "object",
"$ref": "#/definitions/app.Response"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"type": "object",
"$ref": "#/definitions/app.Response"
}
}
}
},
"delete": {
"produces": [
"/pai/closenode": {
"post": {
"description": "关闭节点",
"consumes": [
"application/json"
],
"summary": "Delete article",
"parameters": [
{
"type": "integer",
"description": "ID",
"name": "id",
"in": "path",
"required": true
}
],
"summary": "关闭节点",
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "object",
"$ref": "#/definitions/app.Response"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"type": "object",
"$ref": "#/definitions/app.Response"
}
}
}
}
},
"/api/v1/tags": {
"get": {
"produces": [
"/pai/nodeinfo": {
"post": {
"description": "获取节点运行状态",
"consumes": [
"application/json"
],
"summary": "Get multiple article tags",
"parameters": [
{
"type": "string",
"description": "Name",
"name": "name",
"in": "query"
},
{
"type": "integer",
"description": "State",
"name": "state",
"in": "query"
}
],
"summary": "获取节点运行状态",
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "object",
"$ref": "#/definitions/app.Response"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"type": "object",
"$ref": "#/definitions/app.Response"
}
}
}
},
}
},
"/pai/reset": {
"post": {
"produces": [
"description": "重置节点 慎用(同步时间长 1周以上)",
"consumes": [
"application/json"
],
"summary": "Add article tag",
"parameters": [
{
"description": "Name",
"name": "name",
"in": "body",
"required": true,
"schema": {
"type": "object"
}
},
{
"description": "State",
"name": "state",
"in": "body",
"schema": {
"type": "object"
}
},
{
"description": "CreatedBy",
"name": "created_by",
"in": "body",
"schema": {
"type": "object"
}
}
],
"summary": "重置节点",
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "object",
"$ref": "#/definitions/app.Response"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"type": "object",
"$ref": "#/definitions/app.Response"
}
}
}
}
},
"/api/v1/tags/export": {
"/pai/resetwallet": {
"post": {
"produces": [
"description": "重置节点钱包 无参",
"consumes": [
"application/json"
],
"summary": "Export article tag",
"parameters": [
{
"description": "Name",
"name": "name",
"in": "body",
"schema": {
"type": "object"
}
},
{
"description": "State",
"name": "state",
"in": "body",
"schema": {
"type": "object"
}
}
],
"summary": "重置节点钱包",
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "object",
"$ref": "#/definitions/app.Response"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"type": "object",
"$ref": "#/definitions/app.Response"
}
}
}
}
},
"/api/v1/tags/import": {
"/pai/restartnode": {
"post": {
"produces": [
"description": "重启节点",
"consumes": [
"application/json"
],
"summary": "Import article tag",
"parameters": [
{
"description": "Excel File",
"name": "file",
"in": "body",
"required": true,
"schema": {
"type": "object"
}
}
],
"summary": "重启节点",
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "object",
"$ref": "#/definitions/app.Response"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"type": "object",
"$ref": "#/definitions/app.Response"
}
}
}
}
},
"/api/v1/tags/{id}": {
"put": {
"produces": [
"/pai/updatenode": {
"post": {
"description": "节点手动更新 无参",
"consumes": [
"application/json"
],
"summary": "Update article tag",
"parameters": [
{
"type": "integer",
"description": "ID",
"name": "id",
"in": "path",
"required": true
},
{
"description": "ID",
"name": "name",
"in": "body",
"required": true,
"schema": {
"type": "object"
}
},
{
"description": "State",
"name": "state",
"in": "body",
"schema": {
"type": "object"
}
},
{
"description": "ModifiedBy",
"name": "modified_by",
"in": "body",
"required": true,
"schema": {
"type": "object"
}
}
],
"summary": "节点手动更新",
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "object",
"$ref": "#/definitions/app.Response"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"type": "object",
"$ref": "#/definitions/app.Response"
}
}
}
},
"delete": {
"produces": [
}
},
"/pai/version": {
"post": {
"description": "获取当前版本和最新版本",
"consumes": [
"application/json"
],
"summary": "Delete article tag",
"parameters": [
{
"type": "integer",
"description": "ID",
"name": "id",
"in": "path",
"required": true
}
],
"summary": "获取当前版本和最新版本",
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "object",
"$ref": "#/definitions/app.Response"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"type": "object",
"$ref": "#/definitions/app.Response"
}
}
......@@ -576,23 +244,39 @@ type swaggerInfo struct {
Version string
Host string
BasePath string
Schemes []string
Title string
Description string
}
// SwaggerInfo holds exported Swagger Info so clients can modify it
var SwaggerInfo swaggerInfo
var SwaggerInfo = swaggerInfo{
Version: "1.0",
Host: "",
BasePath: "",
Schemes: []string{},
Title: "Golang Gin API",
Description: "An example of gin",
}
type s struct{}
func (s *s) ReadDoc() string {
t, err := template.New("swagger_info").Parse(doc)
sInfo := SwaggerInfo
sInfo.Description = strings.Replace(sInfo.Description, "\n", "\\n", -1)
t, err := template.New("swagger_info").Funcs(template.FuncMap{
"marshal": func(v interface{}) string {
a, _ := json.Marshal(v)
return string(a)
},
}).Parse(doc)
if err != nil {
return doc
}
var tpl bytes.Buffer
if err := t.Execute(&tpl, SwaggerInfo); err != nil {
if err := t.Execute(&tpl, sInfo); err != nil {
return doc
}
......
......@@ -22,6 +22,13 @@ import (
"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) {
appG := app.Gin{C: c}
util.AddValue(&app.JobID,1)
......@@ -29,9 +36,12 @@ func ResetWallet(c *gin.Context) {
appG.Response(http.StatusOK, e.SUCCESS, app.JobID)
}
//钱包更新,只替换执行文件和配置文件
//具体更新逻辑不再代码实现
//oss下载包打包要保持执行权限
// @Summary 节点手动更新
// @Description 节点手动更新 无参
// @Accept json
// @Success 200 {object} app.Response
// @Failure 500 {object} app.Response
// @Router /pai/updatenode [post]
func UpdateNodeNew(c *gin.Context) {
appG := app.Gin{C: c}
app.BityuanFlag.Lock.Lock()
......@@ -152,7 +162,12 @@ func UpdateNodeNew(c *gin.Context) {
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) {
appG := app.Gin{C: c}
util.AddValue(&app.JobID,1)
......@@ -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) {
appG := app.Gin{C: c}
setting.FreshVersion()
......@@ -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) {
appG := app.Gin{C: c}
var client chain33.PaiClient
......@@ -198,6 +224,12 @@ func NodeInfo(c *gin.Context) {
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) {
appG := app.Gin{C: c}
util.AddValue(&app.JobID,1)
......@@ -205,6 +237,12 @@ func RestartNode(c *gin.Context) {
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) {
appG := app.Gin{C: c}
util.AddValue(&app.JobID,1)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment