|
@@ -5,6 +5,7 @@ import (
|
|
|
"Cold_Api/models/Account"
|
|
|
"Cold_Api/models/System"
|
|
|
beego "github.com/beego/beego/v2/server/web"
|
|
|
+ "github.com/mssola/user_agent"
|
|
|
"time"
|
|
|
)
|
|
|
|
|
@@ -17,6 +18,23 @@ func (c *AdminController) Login() {
|
|
|
|
|
|
}
|
|
|
|
|
|
+// 获取用户登录信息
|
|
|
+func (c *AdminController) GetUserLoginInfo() map[string]interface{} {
|
|
|
+ //Ipaddr ip地址
|
|
|
+ //Browser 浏览器
|
|
|
+ //Os 系统
|
|
|
+ //Platform 固件
|
|
|
+ l := make(map[string]interface{})
|
|
|
+ ua := user_agent.New(c.Ctx.Request.UserAgent())
|
|
|
+ l["ipaddr"] = c.Ctx.Input.IP()
|
|
|
+ l["remark"] = c.Ctx.Request.UserAgent()
|
|
|
+ browserName, browserVersion := ua.Browser()
|
|
|
+ l["browser"] = browserName + " " + browserVersion
|
|
|
+ l["os"] = ua.OS()
|
|
|
+ l["platform"] = ua.Platform()
|
|
|
+ return l
|
|
|
+}
|
|
|
+
|
|
|
func (c *AdminController) Login_verification() {
|
|
|
Admin_user := c.GetString("bzd_username")
|
|
|
Admin_pass := c.GetString("bzd_password")
|
|
@@ -31,7 +49,7 @@ func (c *AdminController) Login_verification() {
|
|
|
c.Ctx.SetCookie("User_tokey", User_tokey, time.Second*60*60)
|
|
|
c.Data["json"] = lib.JSONS{Code: 200, Msg: "OK!", Data: User_tokey}
|
|
|
|
|
|
- System.Add_UserLogs(admin_r.T_uuid, "登陆", "用户登陆", "")
|
|
|
+ System.Add_UserLogs_T(admin_r.T_uuid, "登陆", "用户登陆", c.GetUserLoginInfo())
|
|
|
|
|
|
}
|
|
|
|