feat: 机器列表新增运行状态 & refactor: 登录账号信息存储与context

This commit is contained in:
meilin.huang
2023-11-07 21:05:21 +08:00
parent d9adf0fd25
commit eddda41291
74 changed files with 915 additions and 652 deletions

View File

@@ -2,6 +2,7 @@ package req
import (
"fmt"
"mayfly-go/pkg/contextx"
"mayfly-go/pkg/errorx"
"mayfly-go/pkg/logx"
"mayfly-go/pkg/utils/anyx"
@@ -54,7 +55,7 @@ func LogHandler(rc *Ctx) error {
req := rc.GinCtx.Request
attrMap[req.Method] = req.URL.Path
if la := rc.LoginAccount; la != nil {
if la := contextx.GetLoginAccount(rc.MetaCtx); la != nil {
attrMap["uid"] = la.Id
attrMap["uname"] = la.Username
}
@@ -93,10 +94,10 @@ func LogHandler(rc *Ctx) error {
}
if err := rc.Err; err != nil {
logx.ErrorWithFields(logMsg, attrMap)
logx.ErrorWithFields(rc.MetaCtx, logMsg, attrMap)
return nil
}
logx.InfoWithFields(logMsg, attrMap)
logx.InfoWithFields(rc.MetaCtx, logMsg, attrMap)
return nil
}