From d1020bd255f40a0d12d3af169d93fd8c9abfd05a Mon Sep 17 00:00:00 2001 From: TsMask <340112800@qq.com> Date: Wed, 9 Oct 2024 17:39:22 +0800 Subject: [PATCH] =?UTF-8?q?style:=20gin=E5=86=85=E7=BD=AE=E5=87=BD?= =?UTF-8?q?=E6=95=B0ShouldBindBodyWithJSON?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/framework/utils/ctx/ctx.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/framework/utils/ctx/ctx.go b/src/framework/utils/ctx/ctx.go index cc17a092..b9f2f1e6 100644 --- a/src/framework/utils/ctx/ctx.go +++ b/src/framework/utils/ctx/ctx.go @@ -14,7 +14,6 @@ import ( "golang.org/x/text/language" "github.com/gin-gonic/gin" - "github.com/gin-gonic/gin/binding" ) // QueryMap 查询参数转换Map @@ -30,7 +29,7 @@ func QueryMap(c *gin.Context) map[string]any { // BodyJSONMap JSON参数转换Map func BodyJSONMap(c *gin.Context) map[string]any { params := make(map[string]any) - c.ShouldBindBodyWith(¶ms, binding.JSON) + c.ShouldBindBodyWithJSON(¶ms) return params } @@ -39,7 +38,7 @@ func RequestParamsMap(c *gin.Context) map[string]any { params := make(map[string]any) // json if strings.HasPrefix(c.ContentType(), "application/json") { - c.ShouldBindBodyWith(¶ms, binding.JSON) + c.ShouldBindBodyWithJSON(¶ms) } // 表单