【更新】修复

This commit is contained in:
PandaGoAdmin
2022-08-25 17:36:31 +08:00
parent 2c50a0a83b
commit 762ce034aa
2 changed files with 18 additions and 17 deletions

View File

@@ -85,22 +85,23 @@ func (u *UserApi) Login(rc *restfulx.ReqCtx) {
Token: token,
Expire: time.Now().Unix() + global.Conf.Jwt.ExpireTime,
}
var loginLog logEntity.LogLogin
ua := user_agent.New(rc.Request.Request.UserAgent())
loginLog.Ipaddr = rc.Request.Request.RemoteAddr
loginLog.LoginLocation = utils.GetRealAddressByIP(rc.Request.Request.RemoteAddr)
loginLog.LoginTime = time.Now()
loginLog.Status = "0"
loginLog.Remark = rc.Request.Request.UserAgent()
browserName, browserVersion := ua.Browser()
loginLog.Browser = browserName + " " + browserVersion
loginLog.Os = ua.OS()
loginLog.Platform = ua.Platform()
loginLog.Username = login.Username
loginLog.Msg = "登录成功"
loginLog.CreateBy = login.Username
u.LogLogin.Insert(loginLog)
go func() {
var loginLog logEntity.LogLogin
ua := user_agent.New(rc.Request.Request.UserAgent())
loginLog.Ipaddr = rc.Request.Request.RemoteAddr
loginLog.LoginLocation = utils.GetRealAddressByIP(rc.Request.Request.RemoteAddr)
loginLog.LoginTime = time.Now()
loginLog.Status = "0"
loginLog.Remark = rc.Request.Request.UserAgent()
browserName, browserVersion := ua.Browser()
loginLog.Browser = browserName + " " + browserVersion
loginLog.Os = ua.OS()
loginLog.Platform = ua.Platform()
loginLog.Username = login.Username
loginLog.Msg = "登录成功"
loginLog.CreateBy = login.Username
u.LogLogin.Insert(loginLog)
}()
}
// Auth 用户权限信息