Browse Source

fix: 解决接口文档描述不一致的问题 (#3703)

pull/3707/head
ssongliu 10 months ago committed by GitHub
parent
commit
e85ed7427a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 2
      backend/app/api/v1/backup.go
  2. 2
      backend/app/api/v1/cronjob.go
  3. 2
      backend/app/api/v1/file.go
  4. 12
      backend/app/api/v1/nginx.go
  5. 140
      cmd/server/docs/docs.go
  6. 140
      cmd/server/docs/swagger.json
  7. 90
      cmd/server/docs/swagger.yaml

2
backend/app/api/v1/backup.go

@ -318,7 +318,7 @@ func (b *BaseApi) LoadFilesFromBackup(c *gin.Context) {
// @Param request body dto.CommonBackup true "request" // @Param request body dto.CommonBackup true "request"
// @Success 200 // @Success 200
// @Security ApiKeyAuth // @Security ApiKeyAuth
// @Router /settings/backup/ [post] // @Router /settings/backup/backup [post]
// @x-panel-log {"bodyKeys":["type","name","detailName"],"paramKeys":[],"BeforeFunctions":[],"formatZH":"备份 [type] 数据 [name][detailName]","formatEN":"backup [type] data [name][detailName]"} // @x-panel-log {"bodyKeys":["type","name","detailName"],"paramKeys":[],"BeforeFunctions":[],"formatZH":"备份 [type] 数据 [name][detailName]","formatEN":"backup [type] data [name][detailName]"}
func (b *BaseApi) Backup(c *gin.Context) { func (b *BaseApi) Backup(c *gin.Context) {
var req dto.CommonBackup var req dto.CommonBackup

2
backend/app/api/v1/cronjob.go

@ -95,7 +95,7 @@ func (b *BaseApi) SearchJobRecords(c *gin.Context) {
// @Param request body dto.OperateByID true "request" // @Param request body dto.OperateByID true "request"
// @Success 200 // @Success 200
// @Security ApiKeyAuth // @Security ApiKeyAuth
// @Router /cronjob/record/log [post] // @Router /cronjobs/records/log [post]
func (b *BaseApi) LoadRecordLog(c *gin.Context) { func (b *BaseApi) LoadRecordLog(c *gin.Context) {
var req dto.OperateByID var req dto.OperateByID
if err := helper.CheckBindAndValidate(&req, c); err != nil { if err := helper.CheckBindAndValidate(&req, c); err != nil {

2
backend/app/api/v1/file.go

@ -689,7 +689,7 @@ func (b *BaseApi) Keys(c *gin.Context) {
// @Param request body request.FileReadByLineReq true "request" // @Param request body request.FileReadByLineReq true "request"
// @Success 200 // @Success 200
// @Security ApiKeyAuth // @Security ApiKeyAuth
// @Router /files/log/read [post] // @Router /files/read [post]
func (b *BaseApi) ReadFileByLine(c *gin.Context) { func (b *BaseApi) ReadFileByLine(c *gin.Context) {
var req request.FileReadByLineReq var req request.FileReadByLineReq
if err := helper.CheckBindAndValidate(&req, c); err != nil { if err := helper.CheckBindAndValidate(&req, c); err != nil {

12
backend/app/api/v1/nginx.go

@ -12,7 +12,7 @@ import (
// @Description 获取 OpenResty 配置信息 // @Description 获取 OpenResty 配置信息
// @Success 200 {object} response.FileInfo // @Success 200 {object} response.FileInfo
// @Security ApiKeyAuth // @Security ApiKeyAuth
// @Router /openResty [get] // @Router /openresty [get]
func (b *BaseApi) GetNginx(c *gin.Context) { func (b *BaseApi) GetNginx(c *gin.Context) {
fileInfo, err := nginxService.GetNginxConfig() fileInfo, err := nginxService.GetNginxConfig()
if err != nil { if err != nil {
@ -29,7 +29,7 @@ func (b *BaseApi) GetNginx(c *gin.Context) {
// @Param request body request.NginxScopeReq true "request" // @Param request body request.NginxScopeReq true "request"
// @Success 200 {array} response.NginxParam // @Success 200 {array} response.NginxParam
// @Security ApiKeyAuth // @Security ApiKeyAuth
// @Router /openResty/scope [post] // @Router /openresty/scope [post]
func (b *BaseApi) GetNginxConfigByScope(c *gin.Context) { func (b *BaseApi) GetNginxConfigByScope(c *gin.Context) {
var req request.NginxScopeReq var req request.NginxScopeReq
if err := helper.CheckBindAndValidate(&req, c); err != nil { if err := helper.CheckBindAndValidate(&req, c); err != nil {
@ -51,7 +51,7 @@ func (b *BaseApi) GetNginxConfigByScope(c *gin.Context) {
// @Param request body request.NginxConfigUpdate true "request" // @Param request body request.NginxConfigUpdate true "request"
// @Success 200 // @Success 200
// @Security ApiKeyAuth // @Security ApiKeyAuth
// @Router /openResty/update [post] // @Router /openresty/update [post]
// @x-panel-log {"bodyKeys":["websiteId"],"paramKeys":[],"BeforeFunctions":[{"input_column":"id","input_value":"websiteId","isList":false,"db":"websites","output_column":"primary_domain","output_value":"domain"}],"formatZH":"更新 nginx 配置 [domain]","formatEN":"Update nginx conf [domain]"} // @x-panel-log {"bodyKeys":["websiteId"],"paramKeys":[],"BeforeFunctions":[{"input_column":"id","input_value":"websiteId","isList":false,"db":"websites","output_column":"primary_domain","output_value":"domain"}],"formatZH":"更新 nginx 配置 [domain]","formatEN":"Update nginx conf [domain]"}
func (b *BaseApi) UpdateNginxConfigByScope(c *gin.Context) { func (b *BaseApi) UpdateNginxConfigByScope(c *gin.Context) {
var req request.NginxConfigUpdate var req request.NginxConfigUpdate
@ -70,7 +70,7 @@ func (b *BaseApi) UpdateNginxConfigByScope(c *gin.Context) {
// @Description 获取 OpenResty 状态信息 // @Description 获取 OpenResty 状态信息
// @Success 200 {object} response.NginxStatus // @Success 200 {object} response.NginxStatus
// @Security ApiKeyAuth // @Security ApiKeyAuth
// @Router /openResty/status [get] // @Router /openresty/status [get]
func (b *BaseApi) GetNginxStatus(c *gin.Context) { func (b *BaseApi) GetNginxStatus(c *gin.Context) {
res, err := nginxService.GetStatus() res, err := nginxService.GetStatus()
if err != nil { if err != nil {
@ -87,7 +87,7 @@ func (b *BaseApi) GetNginxStatus(c *gin.Context) {
// @Param request body request.NginxConfigFileUpdate true "request" // @Param request body request.NginxConfigFileUpdate true "request"
// @Success 200 // @Success 200
// @Security ApiKeyAuth // @Security ApiKeyAuth
// @Router /openResty/file [post] // @Router /openresty/file [post]
// @x-panel-log {"bodyKeys":[],"paramKeys":[],"BeforeFunctions":[],"formatZH":"更新 nginx 配置","formatEN":"Update nginx conf"} // @x-panel-log {"bodyKeys":[],"paramKeys":[],"BeforeFunctions":[],"formatZH":"更新 nginx 配置","formatEN":"Update nginx conf"}
func (b *BaseApi) UpdateNginxFile(c *gin.Context) { func (b *BaseApi) UpdateNginxFile(c *gin.Context) {
var req request.NginxConfigFileUpdate var req request.NginxConfigFileUpdate
@ -107,7 +107,7 @@ func (b *BaseApi) UpdateNginxFile(c *gin.Context) {
// @Description 清理 OpenResty 代理缓存 // @Description 清理 OpenResty 代理缓存
// @Success 200 // @Success 200
// @Security ApiKeyAuth // @Security ApiKeyAuth
// @Router /openResty/clear [post] // @Router /openresty/clear [post]
// @x-panel-log {"bodyKeys":[],"paramKeys":[],"BeforeFunctions":[],"formatZH":"清理 Openresty 代理缓存","formatEN":"Clear nginx proxy cache"} // @x-panel-log {"bodyKeys":[],"paramKeys":[],"BeforeFunctions":[],"formatZH":"清理 Openresty 代理缓存","formatEN":"Clear nginx proxy cache"}
func (b *BaseApi) ClearNginxProxyCache(c *gin.Context) { func (b *BaseApi) ClearNginxProxyCache(c *gin.Context) {
if err := nginxService.ClearProxyCache(); err != nil { if err := nginxService.ClearProxyCache(); err != nil {

140
cmd/server/docs/docs.go

@ -3334,39 +3334,6 @@ const docTemplate = `{
} }
} }
}, },
"/cronjob/record/log": {
"post": {
"security": [
{
"ApiKeyAuth": []
}
],
"description": "获取计划任务记录日志",
"consumes": [
"application/json"
],
"tags": [
"Cronjob"
],
"summary": "Load Cronjob record log",
"parameters": [
{
"description": "request",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/dto.OperateByID"
}
}
],
"responses": {
"200": {
"description": "OK"
}
}
}
},
"/cronjobs": { "/cronjobs": {
"post": { "post": {
"security": [ "security": [
@ -3614,6 +3581,39 @@ const docTemplate = `{
} }
} }
}, },
"/cronjobs/records/log": {
"post": {
"security": [
{
"ApiKeyAuth": []
}
],
"description": "获取计划任务记录日志",
"consumes": [
"application/json"
],
"tags": [
"Cronjob"
],
"summary": "Load Cronjob record log",
"parameters": [
{
"description": "request",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/dto.OperateByID"
}
}
],
"responses": {
"200": {
"description": "OK"
}
}
}
},
"/cronjobs/search": { "/cronjobs/search": {
"post": { "post": {
"security": [ "security": [
@ -6139,36 +6139,6 @@ const docTemplate = `{
} }
} }
}, },
"/files/log/read": {
"post": {
"security": [
{
"ApiKeyAuth": []
}
],
"description": "按行读取日志文件",
"tags": [
"File"
],
"summary": "Read file by Line",
"parameters": [
{
"description": "request",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/request.FileReadByLineReq"
}
}
],
"responses": {
"200": {
"description": "OK"
}
}
}
},
"/files/mode": { "/files/mode": {
"post": { "post": {
"security": [ "security": [
@ -6299,6 +6269,36 @@ const docTemplate = `{
} }
} }
}, },
"/files/read": {
"post": {
"security": [
{
"ApiKeyAuth": []
}
],
"description": "按行读取日志文件",
"tags": [
"File"
],
"summary": "Read file by Line",
"parameters": [
{
"description": "request",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/request.FileReadByLineReq"
}
}
],
"responses": {
"200": {
"description": "OK"
}
}
}
},
"/files/recycle/clear": { "/files/recycle/clear": {
"post": { "post": {
"security": [ "security": [
@ -8526,7 +8526,7 @@ const docTemplate = `{
} }
} }
}, },
"/openResty": { "/openresty": {
"get": { "get": {
"security": [ "security": [
{ {
@ -8548,7 +8548,7 @@ const docTemplate = `{
} }
} }
}, },
"/openResty/clear": { "/openresty/clear": {
"post": { "post": {
"security": [ "security": [
{ {
@ -8574,7 +8574,7 @@ const docTemplate = `{
} }
} }
}, },
"/openResty/file": { "/openresty/file": {
"post": { "post": {
"security": [ "security": [
{ {
@ -8614,7 +8614,7 @@ const docTemplate = `{
} }
} }
}, },
"/openResty/scope": { "/openresty/scope": {
"post": { "post": {
"security": [ "security": [
{ {
@ -8653,7 +8653,7 @@ const docTemplate = `{
} }
} }
}, },
"/openResty/status": { "/openresty/status": {
"get": { "get": {
"security": [ "security": [
{ {
@ -8675,7 +8675,7 @@ const docTemplate = `{
} }
} }
}, },
"/openResty/update": { "/openresty/update": {
"post": { "post": {
"security": [ "security": [
{ {
@ -9276,7 +9276,7 @@ const docTemplate = `{
} }
} }
}, },
"/settings/backup/": { "/settings/backup/backup": {
"post": { "post": {
"security": [ "security": [
{ {

140
cmd/server/docs/swagger.json

@ -3327,39 +3327,6 @@
} }
} }
}, },
"/cronjob/record/log": {
"post": {
"security": [
{
"ApiKeyAuth": []
}
],
"description": "获取计划任务记录日志",
"consumes": [
"application/json"
],
"tags": [
"Cronjob"
],
"summary": "Load Cronjob record log",
"parameters": [
{
"description": "request",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/dto.OperateByID"
}
}
],
"responses": {
"200": {
"description": "OK"
}
}
}
},
"/cronjobs": { "/cronjobs": {
"post": { "post": {
"security": [ "security": [
@ -3607,6 +3574,39 @@
} }
} }
}, },
"/cronjobs/records/log": {
"post": {
"security": [
{
"ApiKeyAuth": []
}
],
"description": "获取计划任务记录日志",
"consumes": [
"application/json"
],
"tags": [
"Cronjob"
],
"summary": "Load Cronjob record log",
"parameters": [
{
"description": "request",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/dto.OperateByID"
}
}
],
"responses": {
"200": {
"description": "OK"
}
}
}
},
"/cronjobs/search": { "/cronjobs/search": {
"post": { "post": {
"security": [ "security": [
@ -6132,36 +6132,6 @@
} }
} }
}, },
"/files/log/read": {
"post": {
"security": [
{
"ApiKeyAuth": []
}
],
"description": "按行读取日志文件",
"tags": [
"File"
],
"summary": "Read file by Line",
"parameters": [
{
"description": "request",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/request.FileReadByLineReq"
}
}
],
"responses": {
"200": {
"description": "OK"
}
}
}
},
"/files/mode": { "/files/mode": {
"post": { "post": {
"security": [ "security": [
@ -6292,6 +6262,36 @@
} }
} }
}, },
"/files/read": {
"post": {
"security": [
{
"ApiKeyAuth": []
}
],
"description": "按行读取日志文件",
"tags": [
"File"
],
"summary": "Read file by Line",
"parameters": [
{
"description": "request",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/request.FileReadByLineReq"
}
}
],
"responses": {
"200": {
"description": "OK"
}
}
}
},
"/files/recycle/clear": { "/files/recycle/clear": {
"post": { "post": {
"security": [ "security": [
@ -8519,7 +8519,7 @@
} }
} }
}, },
"/openResty": { "/openresty": {
"get": { "get": {
"security": [ "security": [
{ {
@ -8541,7 +8541,7 @@
} }
} }
}, },
"/openResty/clear": { "/openresty/clear": {
"post": { "post": {
"security": [ "security": [
{ {
@ -8567,7 +8567,7 @@
} }
} }
}, },
"/openResty/file": { "/openresty/file": {
"post": { "post": {
"security": [ "security": [
{ {
@ -8607,7 +8607,7 @@
} }
} }
}, },
"/openResty/scope": { "/openresty/scope": {
"post": { "post": {
"security": [ "security": [
{ {
@ -8646,7 +8646,7 @@
} }
} }
}, },
"/openResty/status": { "/openresty/status": {
"get": { "get": {
"security": [ "security": [
{ {
@ -8668,7 +8668,7 @@
} }
} }
}, },
"/openResty/update": { "/openresty/update": {
"post": { "post": {
"security": [ "security": [
{ {
@ -9269,7 +9269,7 @@
} }
} }
}, },
"/settings/backup/": { "/settings/backup/backup": {
"post": { "post": {
"security": [ "security": [
{ {

90
cmd/server/docs/swagger.yaml

@ -7098,26 +7098,6 @@ paths:
summary: Page volumes summary: Page volumes
tags: tags:
- Container Volume - Container Volume
/cronjob/record/log:
post:
consumes:
- application/json
description: 获取计划任务记录日志
parameters:
- description: request
in: body
name: request
required: true
schema:
$ref: '#/definitions/dto.OperateByID'
responses:
"200":
description: OK
security:
- ApiKeyAuth: []
summary: Load Cronjob record log
tags:
- Cronjob
/cronjobs: /cronjobs:
post: post:
consumes: consumes:
@ -7278,6 +7258,26 @@ paths:
formatEN: clean cronjob [name] records formatEN: clean cronjob [name] records
formatZH: 清空计划任务记录 [name] formatZH: 清空计划任务记录 [name]
paramKeys: [] paramKeys: []
/cronjobs/records/log:
post:
consumes:
- application/json
description: 获取计划任务记录日志
parameters:
- description: request
in: body
name: request
required: true
schema:
$ref: '#/definitions/dto.OperateByID'
responses:
"200":
description: OK
security:
- ApiKeyAuth: []
summary: Load Cronjob record log
tags:
- Cronjob
/cronjobs/search: /cronjobs/search:
post: post:
consumes: consumes:
@ -8879,24 +8879,6 @@ paths:
summary: List favorites summary: List favorites
tags: tags:
- File - File
/files/log/read:
post:
description: 按行读取日志文件
parameters:
- description: request
in: body
name: request
required: true
schema:
$ref: '#/definitions/request.FileReadByLineReq'
responses:
"200":
description: OK
security:
- ApiKeyAuth: []
summary: Read file by Line
tags:
- File
/files/mode: /files/mode:
post: post:
consumes: consumes:
@ -8982,6 +8964,24 @@ paths:
formatEN: Change owner [paths] => [user]/[group] formatEN: Change owner [paths] => [user]/[group]
formatZH: 修改用户/组 [paths] => [user]/[group] formatZH: 修改用户/组 [paths] => [user]/[group]
paramKeys: [] paramKeys: []
/files/read:
post:
description: 按行读取日志文件
parameters:
- description: request
in: body
name: request
required: true
schema:
$ref: '#/definitions/request.FileReadByLineReq'
responses:
"200":
description: OK
security:
- ApiKeyAuth: []
summary: Read file by Line
tags:
- File
/files/recycle/clear: /files/recycle/clear:
post: post:
consumes: consumes:
@ -10388,7 +10388,7 @@ paths:
summary: Load system log files summary: Load system log files
tags: tags:
- Logs - Logs
/openResty: /openresty:
get: get:
description: 获取 OpenResty 配置信息 description: 获取 OpenResty 配置信息
responses: responses:
@ -10401,7 +10401,7 @@ paths:
summary: Load OpenResty conf summary: Load OpenResty conf
tags: tags:
- OpenResty - OpenResty
/openResty/clear: /openresty/clear:
post: post:
description: 清理 OpenResty 代理缓存 description: 清理 OpenResty 代理缓存
responses: responses:
@ -10418,7 +10418,7 @@ paths:
formatEN: Clear nginx proxy cache formatEN: Clear nginx proxy cache
formatZH: 清理 Openresty 代理缓存 formatZH: 清理 Openresty 代理缓存
paramKeys: [] paramKeys: []
/openResty/file: /openresty/file:
post: post:
consumes: consumes:
- application/json - application/json
@ -10444,7 +10444,7 @@ paths:
formatEN: Update nginx conf formatEN: Update nginx conf
formatZH: 更新 nginx 配置 formatZH: 更新 nginx 配置
paramKeys: [] paramKeys: []
/openResty/scope: /openresty/scope:
post: post:
consumes: consumes:
- application/json - application/json
@ -10468,7 +10468,7 @@ paths:
summary: Load partial OpenResty conf summary: Load partial OpenResty conf
tags: tags:
- OpenResty - OpenResty
/openResty/status: /openresty/status:
get: get:
description: 获取 OpenResty 状态信息 description: 获取 OpenResty 状态信息
responses: responses:
@ -10481,7 +10481,7 @@ paths:
summary: Load OpenResty status info summary: Load OpenResty status info
tags: tags:
- OpenResty - OpenResty
/openResty/update: /openresty/update:
post: post:
consumes: consumes:
- application/json - application/json
@ -10857,7 +10857,7 @@ paths:
formatEN: create backup account [type] formatEN: create backup account [type]
formatZH: 创建备份账号 [type] formatZH: 创建备份账号 [type]
paramKeys: [] paramKeys: []
/settings/backup/: /settings/backup/backup:
post: post:
consumes: consumes:
- application/json - application/json

Loading…
Cancel
Save