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,