fix: 初验针对修改
This commit is contained in:
@@ -3,6 +3,7 @@ package controllers
|
||||
import (
|
||||
"errors"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"git.apinb.com/bsm-sdk/core/infra"
|
||||
"git.apinb.com/ops/logs/internal/impl"
|
||||
@@ -292,6 +293,9 @@ func ListLogEvents(ctx *gin.Context) {
|
||||
resourceType := ctx.Query("resource_type")
|
||||
resourceID := ctx.Query("resource_id")
|
||||
dispatchStatus := ctx.Query("dispatch_status")
|
||||
traceID := strings.TrimSpace(ctx.Query("trace_id"))
|
||||
resourceUID := strings.TrimSpace(ctx.Query("resource_uid"))
|
||||
businessSystemID, _ := strconv.ParseUint(ctx.Query("business_system_id"), 10, 32)
|
||||
logEventID, _ := strconv.ParseUint(ctx.DefaultQuery("log_event_id", "0"), 10, 64)
|
||||
page, _ := strconv.Atoi(ctx.DefaultQuery("page", "1"))
|
||||
size, _ := strconv.Atoi(ctx.DefaultQuery("page_size", "50"))
|
||||
@@ -315,6 +319,16 @@ func ListLogEvents(ctx *gin.Context) {
|
||||
if dispatchStatus != "" {
|
||||
q = q.Where("dispatch_status = ?", dispatchStatus)
|
||||
}
|
||||
if traceID != "" {
|
||||
q = q.Where("trace_id = ?", strings.ToLower(traceID))
|
||||
}
|
||||
if resourceUID != "" {
|
||||
q = q.Where("resource_uid = ?", resourceUID)
|
||||
}
|
||||
if businessSystemID > 0 {
|
||||
traceScope := impl.DBService.Model(&models.TraceSpan{}).Select("trace_id").Where("business_system_id = ?", uint(businessSystemID))
|
||||
q = q.Where("business_system_id = ? OR trace_id IN (?)", uint(businessSystemID), traceScope)
|
||||
}
|
||||
if logEventID > 0 {
|
||||
q = q.Where("id = ?", uint(logEventID))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user