mirror of
https://gitee.com/XM-GO/PandaX.git
synced 2026-04-23 02:48:34 +08:00
【更新】修复
This commit is contained in:
@@ -85,22 +85,23 @@ func (u *UserApi) Login(rc *restfulx.ReqCtx) {
|
|||||||
Token: token,
|
Token: token,
|
||||||
Expire: time.Now().Unix() + global.Conf.Jwt.ExpireTime,
|
Expire: time.Now().Unix() + global.Conf.Jwt.ExpireTime,
|
||||||
}
|
}
|
||||||
|
go func() {
|
||||||
var loginLog logEntity.LogLogin
|
var loginLog logEntity.LogLogin
|
||||||
ua := user_agent.New(rc.Request.Request.UserAgent())
|
ua := user_agent.New(rc.Request.Request.UserAgent())
|
||||||
loginLog.Ipaddr = rc.Request.Request.RemoteAddr
|
loginLog.Ipaddr = rc.Request.Request.RemoteAddr
|
||||||
loginLog.LoginLocation = utils.GetRealAddressByIP(rc.Request.Request.RemoteAddr)
|
loginLog.LoginLocation = utils.GetRealAddressByIP(rc.Request.Request.RemoteAddr)
|
||||||
loginLog.LoginTime = time.Now()
|
loginLog.LoginTime = time.Now()
|
||||||
loginLog.Status = "0"
|
loginLog.Status = "0"
|
||||||
loginLog.Remark = rc.Request.Request.UserAgent()
|
loginLog.Remark = rc.Request.Request.UserAgent()
|
||||||
browserName, browserVersion := ua.Browser()
|
browserName, browserVersion := ua.Browser()
|
||||||
loginLog.Browser = browserName + " " + browserVersion
|
loginLog.Browser = browserName + " " + browserVersion
|
||||||
loginLog.Os = ua.OS()
|
loginLog.Os = ua.OS()
|
||||||
loginLog.Platform = ua.Platform()
|
loginLog.Platform = ua.Platform()
|
||||||
loginLog.Username = login.Username
|
loginLog.Username = login.Username
|
||||||
loginLog.Msg = "登录成功"
|
loginLog.Msg = "登录成功"
|
||||||
loginLog.CreateBy = login.Username
|
loginLog.CreateBy = login.Username
|
||||||
u.LogLogin.Insert(loginLog)
|
u.LogLogin.Insert(loginLog)
|
||||||
|
}()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Auth 用户权限信息
|
// Auth 用户权限信息
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ func (p *{{.ClassName}}Api) Get{{.ClassName}}List(rc *restfulx.ReqCtx) {
|
|||||||
// Get{{.ClassName}} 获取{{.FunctionName}}
|
// Get{{.ClassName}} 获取{{.FunctionName}}
|
||||||
func (p *{{.ClassName}}Api) Get{{.ClassName}}(rc *restfulx.ReqCtx) {
|
func (p *{{.ClassName}}Api) Get{{.ClassName}}(rc *restfulx.ReqCtx) {
|
||||||
{{.PkJsonField}} := restfulx.PathParamInt(rc, "{{.PkJsonField}}")
|
{{.PkJsonField}} := restfulx.PathParamInt(rc, "{{.PkJsonField}}")
|
||||||
p.{{.ClassName}}App.FindOne(int64({{.PkJsonField}}))
|
rc.ResData = p.{{.ClassName}}App.FindOne(int64({{.PkJsonField}}))
|
||||||
}
|
}
|
||||||
|
|
||||||
// Insert{{.ClassName}} 添加{{.FunctionName}}
|
// Insert{{.ClassName}} 添加{{.FunctionName}}
|
||||||
|
|||||||
Reference in New Issue
Block a user