From 16473707eebbf046b51753e0c70953642e0a5bd1 Mon Sep 17 00:00:00 2001 From: Evan Chen Date: Sat, 18 Dec 2021 20:43:56 +0800 Subject: [PATCH] update --- auth/api_auth.go | 7 ++----- auth/api_grp.go | 4 ++++ 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/auth/api_auth.go b/auth/api_auth.go index 882771c..7df564f 100644 --- a/auth/api_auth.go +++ b/auth/api_auth.go @@ -91,12 +91,9 @@ func ApiLogin(c *gin.Context) { }) // send to history - history.Send(history.Info().Grp(usr.Username).Nm("Login"). + history.Send(history.Info().Iss(usr.Username).Nm("Login"). Msgf("user login from %v", usr.LastLoginIP). - Bd(map[string]string{ - "username": usr.Username, - "login_ip": usr.LastLoginIP, - })) + Bd(usr.LastLoginIP)) server.Res(c, &server.Response{ Status: 200, diff --git a/auth/api_grp.go b/auth/api_grp.go index 0e4d9c2..837c6c7 100644 --- a/auth/api_grp.go +++ b/auth/api_grp.go @@ -6,6 +6,7 @@ import ( "github.com/gin-gonic/gin" "gorm.io/gorm" "kumoly.io/kumoly/app/errors" + "kumoly.io/kumoly/app/history" "kumoly.io/kumoly/app/server" ) @@ -46,6 +47,9 @@ func ApiGrpNew(c *gin.Context) { if err := DB.Create(grp).Error; err != nil { panic(err) } + history.Send(history.Info().Nm("Create"). + Bd(data).Grp(data.Name). + Iss(c.GetString(GinUserKey))) server.Res(c, &server.Response{Data: grp}) }