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"
// @Success 200
// @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]"}
func (b *BaseApi) Backup(c *gin.Context) {
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"
// @Success 200
// @Security ApiKeyAuth
// @Router /cronjob/record/log [post]
// @Router /cronjobs/records/log [post]
func (b *BaseApi) LoadRecordLog(c *gin.Context) {
var req dto.OperateByID
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"
// @Success 200
// @Security ApiKeyAuth
// @Router /files/log/read [post]
// @Router /files/read [post]
func (b *BaseApi) ReadFileByLine(c *gin.Context) {
var req request.FileReadByLineReq
if err := helper.CheckBindAndValidate(&req, c); err != nil {

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

@ -12,7 +12,7 @@ import (
// @Description 获取 OpenResty 配置信息
// @Success 200 {object} response.FileInfo
// @Security ApiKeyAuth
// @Router /openResty [get]
// @Router /openresty [get]
func (b *BaseApi) GetNginx(c *gin.Context) {
fileInfo, err := nginxService.GetNginxConfig()
if err != nil {
@ -29,7 +29,7 @@ func (b *BaseApi) GetNginx(c *gin.Context) {
// @Param request body request.NginxScopeReq true "request"
// @Success 200 {array} response.NginxParam
// @Security ApiKeyAuth
// @Router /openResty/scope [post]
// @Router /openresty/scope [post]
func (b *BaseApi) GetNginxConfigByScope(c *gin.Context) {
var req request.NginxScopeReq
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"
// @Success 200
// @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]"}
func (b *BaseApi) UpdateNginxConfigByScope(c *gin.Context) {
var req request.NginxConfigUpdate
@ -70,7 +70,7 @@ func (b *BaseApi) UpdateNginxConfigByScope(c *gin.Context) {
// @Description 获取 OpenResty 状态信息
// @Success 200 {object} response.NginxStatus
// @Security ApiKeyAuth
// @Router /openResty/status [get]
// @Router /openresty/status [get]
func (b *BaseApi) GetNginxStatus(c *gin.Context) {
res, err := nginxService.GetStatus()
if err != nil {
@ -87,7 +87,7 @@ func (b *BaseApi) GetNginxStatus(c *gin.Context) {
// @Param request body request.NginxConfigFileUpdate true "request"
// @Success 200
// @Security ApiKeyAuth
// @Router /openResty/file [post]
// @Router /openresty/file [post]
// @x-panel-log {"bodyKeys":[],"paramKeys":[],"BeforeFunctions":[],"formatZH":"更新 nginx 配置","formatEN":"Update nginx conf"}
func (b *BaseApi) UpdateNginxFile(c *gin.Context) {
var req request.NginxConfigFileUpdate
@ -107,7 +107,7 @@ func (b *BaseApi) UpdateNginxFile(c *gin.Context) {
// @Description 清理 OpenResty 代理缓存
// @Success 200
// @Security ApiKeyAuth
// @Router /openResty/clear [post]
// @Router /openresty/clear [post]
// @x-panel-log {"bodyKeys":[],"paramKeys":[],"BeforeFunctions":[],"formatZH":"清理 Openresty 代理缓存","formatEN":"Clear nginx proxy cache"}
func (b *BaseApi) ClearNginxProxyCache(c *gin.Context) {
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": {
"post": {
"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": {
"post": {
"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": {
"post": {
"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": {
"post": {
"security": [
@ -8526,7 +8526,7 @@ const docTemplate = `{
}
}
},
"/openResty": {
"/openresty": {
"get": {
"security": [
{
@ -8548,7 +8548,7 @@ const docTemplate = `{
}
}
},
"/openResty/clear": {
"/openresty/clear": {
"post": {
"security": [
{
@ -8574,7 +8574,7 @@ const docTemplate = `{
}
}
},
"/openResty/file": {
"/openresty/file": {
"post": {
"security": [
{
@ -8614,7 +8614,7 @@ const docTemplate = `{
}
}
},
"/openResty/scope": {
"/openresty/scope": {
"post": {
"security": [
{
@ -8653,7 +8653,7 @@ const docTemplate = `{
}
}
},
"/openResty/status": {
"/openresty/status": {
"get": {
"security": [
{
@ -8675,7 +8675,7 @@ const docTemplate = `{
}
}
},
"/openResty/update": {
"/openresty/update": {
"post": {
"security": [
{
@ -9276,7 +9276,7 @@ const docTemplate = `{
}
}
},
"/settings/backup/": {
"/settings/backup/backup": {
"post": {
"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": {
"post": {
"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": {
"post": {
"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": {
"post": {
"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": {
"post": {
"security": [
@ -8519,7 +8519,7 @@
}
}
},
"/openResty": {
"/openresty": {
"get": {
"security": [
{
@ -8541,7 +8541,7 @@
}
}
},
"/openResty/clear": {
"/openresty/clear": {
"post": {
"security": [
{
@ -8567,7 +8567,7 @@
}
}
},
"/openResty/file": {
"/openresty/file": {
"post": {
"security": [
{
@ -8607,7 +8607,7 @@
}
}
},
"/openResty/scope": {
"/openresty/scope": {
"post": {
"security": [
{
@ -8646,7 +8646,7 @@
}
}
},
"/openResty/status": {
"/openresty/status": {
"get": {
"security": [
{
@ -8668,7 +8668,7 @@
}
}
},
"/openResty/update": {
"/openresty/update": {
"post": {
"security": [
{
@ -9269,7 +9269,7 @@
}
}
},
"/settings/backup/": {
"/settings/backup/backup": {
"post": {
"security": [
{

90
cmd/server/docs/swagger.yaml

@ -7098,26 +7098,6 @@ paths:
summary: Page volumes
tags:
- 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:
post:
consumes:
@ -7278,6 +7258,26 @@ paths:
formatEN: clean cronjob [name] records
formatZH: 清空计划任务记录 [name]
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:
post:
consumes:
@ -8879,24 +8879,6 @@ paths:
summary: List favorites
tags:
- 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:
post:
consumes:
@ -8982,6 +8964,24 @@ paths:
formatEN: Change owner [paths] => [user]/[group]
formatZH: 修改用户/组 [paths] => [user]/[group]
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:
post:
consumes:
@ -10388,7 +10388,7 @@ paths:
summary: Load system log files
tags:
- Logs
/openResty:
/openresty:
get:
description: 获取 OpenResty 配置信息
responses:
@ -10401,7 +10401,7 @@ paths:
summary: Load OpenResty conf
tags:
- OpenResty
/openResty/clear:
/openresty/clear:
post:
description: 清理 OpenResty 代理缓存
responses:
@ -10418,7 +10418,7 @@ paths:
formatEN: Clear nginx proxy cache
formatZH: 清理 Openresty 代理缓存
paramKeys: []
/openResty/file:
/openresty/file:
post:
consumes:
- application/json
@ -10444,7 +10444,7 @@ paths:
formatEN: Update nginx conf
formatZH: 更新 nginx 配置
paramKeys: []
/openResty/scope:
/openresty/scope:
post:
consumes:
- application/json
@ -10468,7 +10468,7 @@ paths:
summary: Load partial OpenResty conf
tags:
- OpenResty
/openResty/status:
/openresty/status:
get:
description: 获取 OpenResty 状态信息
responses:
@ -10481,7 +10481,7 @@ paths:
summary: Load OpenResty status info
tags:
- OpenResty
/openResty/update:
/openresty/update:
post:
consumes:
- application/json
@ -10857,7 +10857,7 @@ paths:
formatEN: create backup account [type]
formatZH: 创建备份账号 [type]
paramKeys: []
/settings/backup/:
/settings/backup/backup:
post:
consumes:
- application/json

Loading…
Cancel
Save