master
Evan Chen 2021-12-18 20:43:56 +08:00
parent cdeb2be832
commit 16473707ee
2 changed files with 6 additions and 5 deletions

View File

@ -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,

View File

@ -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})
}