From a6c94d55b1430445d542d5817029b651d240b6c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E8=8C=B6=E6=B8=85=E6=AC=A2?= Date: Tue, 2 Jan 2024 16:04:17 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8C=85=E8=A3=85get=20query?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- request/wrapper.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/request/wrapper.go b/request/wrapper.go index d031144..c82000f 100644 --- a/request/wrapper.go +++ b/request/wrapper.go @@ -10,6 +10,7 @@ package request import ( "git.zhangdeman.cn/zhangdeman/wrapper" "github.com/gin-gonic/gin" + "net/url" "strings" ) @@ -61,6 +62,18 @@ func (wh *wrapperHandle) GetUri(ctx *gin.Context, defaultVal string) string { return defaultVal } +// GetQuery 获取query参数 +// +// Author : go_developer@163.com<白茶清欢> +// +// Date : 16:03 2024/1/2 +func (wh *wrapperHandle) GetQuery(ctx *gin.Context) url.Values { + if nil != ctx && nil != ctx.Request && nil != ctx.Request.URL { + return ctx.Request.URL.Query() + } + return make(url.Values) +} + // GetMethod 获取请求方法 // // Author : go_developer@163.com<白茶清欢>