diff --git a/monitor-server/middleware/session.go b/monitor-server/middleware/session.go index 154721c48..ca00fb2d0 100644 --- a/monitor-server/middleware/session.go +++ b/monitor-server/middleware/session.go @@ -78,6 +78,10 @@ func SaveSession(session m.Session) (isOk bool,sId string) { } func GetOperateUser(c *gin.Context) string { + operator := c.GetString("operatorName") + if operator != "" { + return operator + } if !m.Config().Http.Session.Enable { coreToken := GetCoreToken(c) return coreToken.User @@ -98,34 +102,6 @@ func GetOperateUser(c *gin.Context) string { } } -//func GetCoreRequestRoleList(c *gin.Context) []string { -// var result []string -// authHeader := c.GetHeader("Authorization") -// if authHeader == "" { -// return result -// } -// authHeader = authHeader[strings.Index(authHeader, ".")+1:] -// authHeader = authHeader[:strings.LastIndex(authHeader, ".")] -// authHeader += "==" -// b,err := base64.StdEncoding.DecodeString(authHeader) -// if err != nil { -// log.Logger.Error("Decode core request base64 fail", log.Error(err)) -// return result -// } -// var requestToke m.CoreRequestToken -// err = json.Unmarshal(b, &requestToke) -// if err != nil { -// log.Logger.Error("Get core token,json unmarchal fail", log.Error(err)) -// return result -// } -// if requestToke.Authority != "" { -// requestToke.Authority = strings.Replace(requestToke.Authority, "[", "", -1) -// requestToke.Authority = strings.Replace(requestToke.Authority, "]", "", -1) -// result = strings.Split(requestToke.Authority, ",") -// } -// return result -//} - func GetSessionData(sId string) m.Session { var result m.Session localContain := false diff --git a/monitor-server/services/db/alarm.go b/monitor-server/services/db/alarm.go index 3d7cd57b4..7d8b4a6c5 100644 --- a/monitor-server/services/db/alarm.go +++ b/monitor-server/services/db/alarm.go @@ -1318,7 +1318,7 @@ func QueryHistoryAlarm(param m.QueryHistoryAlarmParam) (err error, result m.Alar whereSql += fmt.Sprintf(" AND s_metric='%s' ", param.Metric) } if param.Filter == "all" { - sql = "SELECT * FROM alarm WHERE start<='" + endString + "' OR end>='" + startString + "' " + whereSql + " ORDER BY id DESC" + sql = "SELECT * FROM alarm WHERE (start<='" + endString + "' OR end>='" + startString + "') " + whereSql + " ORDER BY id DESC" } if param.Filter == "start" { sql = "SELECT * FROM alarm WHERE start>='" + startString + "' AND start<'" + endString + "' " + whereSql + " ORDER BY id DESC" diff --git a/monitor-ui/package.json b/monitor-ui/package.json index 7699003ff..c9f2ffd88 100644 --- a/monitor-ui/package.json +++ b/monitor-ui/package.json @@ -11,7 +11,7 @@ "dependencies": { "@types/js-cookie": "^2.2.6", "@vue/cli-plugin-typescript": "^4.3.1", - "axios": "^0.19.0", + "axios": "^0.21.1", "bootstrap": "^4.3.1", "colresizable": "^1.6.0", "core-js": "^2.6.5",