style: 创建系统登录日志
This commit is contained in:
@@ -52,7 +52,7 @@ func (s *AccountController) Login(c *gin.Context) {
|
||||
// 根据错误信息,创建系统访问记录
|
||||
if err != nil {
|
||||
msg := err.Error() + " " + loginBody.Code
|
||||
s.sysLogLoginService.NewSysLogLogin(
|
||||
s.sysLogLoginService.CreateSysLogLogin(
|
||||
loginBody.Username, commonConstants.STATUS_NO, msg,
|
||||
ipaddr, location, os, browser,
|
||||
)
|
||||
@@ -73,7 +73,7 @@ func (s *AccountController) Login(c *gin.Context) {
|
||||
c.JSON(200, result.Err(nil))
|
||||
return
|
||||
} else {
|
||||
s.sysLogLoginService.NewSysLogLogin(
|
||||
s.sysLogLoginService.CreateSysLogLogin(
|
||||
loginBody.Username, commonConstants.STATUS_YES, "登录成功",
|
||||
ipaddr, location, os, browser,
|
||||
)
|
||||
@@ -133,7 +133,7 @@ func (s *AccountController) Logout(c *gin.Context) {
|
||||
ipaddr, location := ctxUtils.IPAddrLocation(c)
|
||||
os, browser := ctxUtils.UaOsBrowser(c)
|
||||
// 创建系统访问记录
|
||||
s.sysLogLoginService.NewSysLogLogin(
|
||||
s.sysLogLoginService.CreateSysLogLogin(
|
||||
userName, commonConstants.STATUS_YES, "退出成功",
|
||||
ipaddr, location, os, browser,
|
||||
)
|
||||
|
||||
@@ -66,7 +66,7 @@ func (s *RegisterController) UserName(c *gin.Context) {
|
||||
// 根据错误信息,创建系统访问记录
|
||||
if err != nil {
|
||||
msg := err.Error() + " " + registerBody.Code
|
||||
s.sysLogLoginService.NewSysLogLogin(
|
||||
s.sysLogLoginService.CreateSysLogLogin(
|
||||
registerBody.Username, commonConstants.STATUS_NO, msg,
|
||||
ipaddr, location, os, browser,
|
||||
)
|
||||
@@ -77,8 +77,8 @@ func (s *RegisterController) UserName(c *gin.Context) {
|
||||
infoStr := s.registerService.ByUserName(registerBody.Username, registerBody.Password, registerBody.UserType)
|
||||
if !strings.HasPrefix(infoStr, "注册") {
|
||||
msg := registerBody.Username + " 注册成功 " + infoStr
|
||||
s.sysLogLoginService.NewSysLogLogin(
|
||||
registerBody.Username, commonConstants.STATUS_NO, msg,
|
||||
s.sysLogLoginService.CreateSysLogLogin(
|
||||
registerBody.Username, commonConstants.STATUS_YES, msg,
|
||||
ipaddr, location, os, browser,
|
||||
)
|
||||
c.JSON(200, result.OkMsg("注册成功"))
|
||||
|
||||
@@ -19,6 +19,6 @@ type ISysLogLogin interface {
|
||||
// CleanSysLogLogin 清空系统登录日志
|
||||
CleanSysLogLogin() error
|
||||
|
||||
// NewSysLogLogin 生成系统登录日志
|
||||
NewSysLogLogin(userName, status, msg string, ilobArgs ...string) string
|
||||
// CreateSysLogLogin 创建系统登录日志
|
||||
CreateSysLogLogin(userName, status, msg string, ilobArgs ...string) string
|
||||
}
|
||||
|
||||
@@ -41,8 +41,8 @@ func (s *SysLogLoginImpl) CleanSysLogLogin() error {
|
||||
return s.sysLogLoginService.CleanSysLogLogin()
|
||||
}
|
||||
|
||||
// NewSysLogLogin 生成系统登录日志
|
||||
func (s *SysLogLoginImpl) NewSysLogLogin(userName, status, msg string, ilobArgs ...string) string {
|
||||
// CreateSysLogLogin 创建系统登录日志
|
||||
func (s *SysLogLoginImpl) CreateSysLogLogin(userName, status, msg string, ilobArgs ...string) string {
|
||||
sysSysLogLogin := model.SysLogLogin{
|
||||
IPAddr: ilobArgs[0],
|
||||
LoginLocation: ilobArgs[1],
|
||||
|
||||
Reference in New Issue
Block a user