From ecc0bb6a6d2796a69646c58ee90f715448d88883 Mon Sep 17 00:00:00 2001 From: fuwx Date: Wed, 16 Oct 2024 17:37:34 +0800 Subject: [PATCH] update func --- backend/docs/docs.go | 8 ++++---- backend/docs/swagger.json | 8 ++++---- backend/docs/swagger.yaml | 8 ++++---- backend/pkg/api/log/func_deleteothertable.go | 2 +- backend/pkg/api/log/func_deleteparserule.go | 2 +- backend/pkg/api/log/func_othertableinfo.go | 6 +++--- backend/pkg/api/log/handler.go | 6 +++--- backend/pkg/model/request/log_other.go | 4 ++-- 8 files changed, 22 insertions(+), 22 deletions(-) diff --git a/backend/docs/docs.go b/backend/docs/docs.go index 1d0608a..b3ee05c 100644 --- a/backend/docs/docs.go +++ b/backend/docs/docs.go @@ -893,7 +893,7 @@ const docTemplate = `{ } }, "/api/log/other/delete": { - "post": { + "delete": { "description": "移除外部日志表", "consumes": [ "application/json" @@ -933,10 +933,10 @@ const docTemplate = `{ } }, "/api/log/other/table": { - "post": { + "get": { "description": "获取外部日志表信息", "consumes": [ - "application/json" + "application/x-www-form-urlencoded" ], "produces": [ "application/json" @@ -1053,7 +1053,7 @@ const docTemplate = `{ } }, "/api/log/rule/delete": { - "post": { + "delete": { "description": "删除日志表解析规则", "consumes": [ "application/json" diff --git a/backend/docs/swagger.json b/backend/docs/swagger.json index ed65d43..c5d7127 100644 --- a/backend/docs/swagger.json +++ b/backend/docs/swagger.json @@ -885,7 +885,7 @@ } }, "/api/log/other/delete": { - "post": { + "delete": { "description": "移除外部日志表", "consumes": [ "application/json" @@ -925,10 +925,10 @@ } }, "/api/log/other/table": { - "post": { + "get": { "description": "获取外部日志表信息", "consumes": [ - "application/json" + "application/x-www-form-urlencoded" ], "produces": [ "application/json" @@ -1045,7 +1045,7 @@ } }, "/api/log/rule/delete": { - "post": { + "delete": { "description": "删除日志表解析规则", "consumes": [ "application/json" diff --git a/backend/docs/swagger.yaml b/backend/docs/swagger.yaml index 9e5cc60..a81d089 100644 --- a/backend/docs/swagger.yaml +++ b/backend/docs/swagger.yaml @@ -2663,7 +2663,7 @@ paths: tags: - API.log /api/log/other/delete: - post: + delete: consumes: - application/json description: 移除外部日志表 @@ -2689,9 +2689,9 @@ paths: tags: - API.log /api/log/other/table: - post: + get: consumes: - - application/json + - application/x-www-form-urlencoded description: 获取外部日志表信息 parameters: - description: 请求信息 @@ -2767,7 +2767,7 @@ paths: tags: - API.log /api/log/rule/delete: - post: + delete: consumes: - application/json description: 删除日志表解析规则 diff --git a/backend/pkg/api/log/func_deleteothertable.go b/backend/pkg/api/log/func_deleteothertable.go index f748e5a..e1d9bbb 100644 --- a/backend/pkg/api/log/func_deleteothertable.go +++ b/backend/pkg/api/log/func_deleteothertable.go @@ -17,7 +17,7 @@ import ( // @Param Request body request.DeleteOtherTableRequest true "请求信息" // @Success 200 {object} response.DeleteOtherTableResponse // @Failure 400 {object} code.Failure -// @Router /api/log/other/delete [post] +// @Router /api/log/other/delete [delete] func (h *handler) DeleteOtherTable() core.HandlerFunc { return func(c core.Context) { req := new(request.DeleteOtherTableRequest) diff --git a/backend/pkg/api/log/func_deleteparserule.go b/backend/pkg/api/log/func_deleteparserule.go index be51b25..d9529ce 100644 --- a/backend/pkg/api/log/func_deleteparserule.go +++ b/backend/pkg/api/log/func_deleteparserule.go @@ -17,7 +17,7 @@ import ( // @Param Request body request.DeleteLogParseRequest true "请求信息" // @Success 200 {object} response.LogParseResponse // @Failure 400 {object} code.Failure -// @Router /api/log/rule/delete [post] +// @Router /api/log/rule/delete [delete] func (h *handler) DeleteLogParseRule() core.HandlerFunc { return func(c core.Context) { req := new(request.DeleteLogParseRequest) diff --git a/backend/pkg/api/log/func_othertableinfo.go b/backend/pkg/api/log/func_othertableinfo.go index 7e97dc7..c27428d 100644 --- a/backend/pkg/api/log/func_othertableinfo.go +++ b/backend/pkg/api/log/func_othertableinfo.go @@ -12,16 +12,16 @@ import ( // @Summary 获取外部日志表信息 // @Description 获取外部日志表信息 // @Tags API.log -// @Accept json +// @Accept application/x-www-form-urlencoded // @Produce json // @Param Request body request.OtherTableInfoRequest true "请求信息" // @Success 200 {object} response.OtherTableInfoResponse // @Failure 400 {object} code.Failure -// @Router /api/log/other/table [post] +// @Router /api/log/other/table [get] func (h *handler) OtherTableInfo() core.HandlerFunc { return func(c core.Context) { req := new(request.OtherTableInfoRequest) - if err := c.ShouldBindJSON(req); err != nil { + if err := c.ShouldBindQuery(req); err != nil { c.AbortWithError(core.Error( http.StatusBadRequest, code.ParamBindError, diff --git a/backend/pkg/api/log/handler.go b/backend/pkg/api/log/handler.go index f046c61..2d6484e 100644 --- a/backend/pkg/api/log/handler.go +++ b/backend/pkg/api/log/handler.go @@ -69,7 +69,7 @@ type Handler interface { // DeleteLogParseRule 删除日志表解析规则 // @Tags API.log - // @Router /api/log/rule/delete [post] + // @Router /api/log/rule/delete [delete] DeleteLogParseRule() core.HandlerFunc // OtherTable 获取外部日志表 @@ -79,7 +79,7 @@ type Handler interface { // OtherTableInfo 获取外部日志表信息 // @Tags API.log - // @Router /api/log/other/table [post] + // @Router /api/log/other/table [get] OtherTableInfo() core.HandlerFunc // AddOtherTable 添加外部日志表 @@ -89,7 +89,7 @@ type Handler interface { // DeleteOtherTable 移除外部日志表 // @Tags API.log - // @Router /api/log/other/delete [post] + // @Router /api/log/other/delete [delete] DeleteOtherTable() core.HandlerFunc } diff --git a/backend/pkg/model/request/log_other.go b/backend/pkg/model/request/log_other.go index 99c5055..8a12862 100644 --- a/backend/pkg/model/request/log_other.go +++ b/backend/pkg/model/request/log_other.go @@ -6,8 +6,8 @@ type OtherTableRequest struct { } type OtherTableInfoRequest struct { - DataBase string `json:"dataBase"` - TableName string `json:"tableName"` + DataBase string `form:"dataBase" json:"dataBase"` + TableName string `form:"tableName" json:"tableName"` } type AddOtherTableRequest struct {