From 8c48a78f032f3a35ddf12b2d27a45921eb2636bb Mon Sep 17 00:00:00 2001 From: suyl <770236076@qq.com> Date: Thu, 15 Jul 2021 17:35:26 +0800 Subject: [PATCH] a --- controllers/user_controller.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/controllers/user_controller.go b/controllers/user_controller.go index e0f1c97..5b25b9a 100644 --- a/controllers/user_controller.go +++ b/controllers/user_controller.go @@ -7,6 +7,7 @@ import ( "git.rosy.net.cn/jx-print/services" "git.rosy.net.cn/jx-print/utils" "github.com/gin-gonic/gin" + "io/ioutil" "net/http" ) @@ -28,13 +29,14 @@ func RegisterUser(c *gin.Context) { err error user = &UserParam{} ) - globals.SugarLogger.Debugf("Begin API :%s params: %v ip: %s", c.Request.URL, c.Params, c.ClientIP()) + data, _ := ioutil.ReadAll(c.Request.Body) + globals.SugarLogger.Debugf("Begin API :%s params: %v ip: %s", c.Request.URL, string(data), c.ClientIP()) if err = c.ShouldBind(&user); err != nil { c.JSON(http.StatusOK, &CallBack{ Code: model.ErrCodeNormal, Desc: err.Error(), }) - globals.SugarLogger.Debugf("End API :%s error:%v:", c.Request.URL, err) + globals.SugarLogger.Debugf("API :%s error:%v:", c.Request.URL, err) return } if !captchaVerify(c, user.Code) { @@ -60,7 +62,8 @@ func Login(c *gin.Context) { err error user = &UserParam{} ) - globals.SugarLogger.Debugf("Begin API :%s params: %v ip: %s", c.Request.URL, c.Params, c.ClientIP()) + data, _ := ioutil.ReadAll(c.Request.Body) + globals.SugarLogger.Debugf("Begin API :%s params: %v ip: %s", c.Request.URL, string(data), c.ClientIP()) if err = c.Bind(&user); err != nil { c.JSON(http.StatusOK, &CallBack{ Code: model.ErrCodeNormal,