diff --git a/client/internal/http/server.go b/client/internal/http/server.go index 18b1c9a..aeda782 100644 --- a/client/internal/http/server.go +++ b/client/internal/http/server.go @@ -48,6 +48,7 @@ func (s *Server) initRouters() { s.engine.POST("/storage/loadPackage", s.StorageSvc().LoadPackage) s.engine.POST("/storage/createPackage", s.StorageSvc().CreatePackage) + s.engine.GET("/storage/getInfo", s.StorageSvc().GetInfo) s.engine.POST("/cache/movePackage", s.CacheSvc().MovePackage) s.engine.GET("/cache/getPackageObjectCacheInfos", s.CacheSvc().GetPackageObjectCacheInfos) diff --git a/client/internal/http/storage.go b/client/internal/http/storage.go index f707387..46ea388 100644 --- a/client/internal/http/storage.go +++ b/client/internal/http/storage.go @@ -128,8 +128,8 @@ func (s *StorageService) CreatePackage(ctx *gin.Context) { } type StorageGetInfoReq struct { - UserID *int64 `json:"userID" binding:"required"` - StorageID *int64 `json:"storageID" binding:"required"` + UserID *int64 `form:"userID" binding:"required"` + StorageID *int64 `form:"storageID" binding:"required"` } type StorageGetInfoResp struct { @@ -140,8 +140,8 @@ func (s *StorageService) GetInfo(ctx *gin.Context) { log := logger.WithField("HTTP", "Storage.GetInfo") var req StorageGetInfoReq - if err := ctx.ShouldBindJSON(&req); err != nil { - log.Warnf("binding body: %s", err.Error()) + if err := ctx.ShouldBindQuery(&req); err != nil { + log.Warnf("binding query: %s", err.Error()) ctx.JSON(http.StatusBadRequest, Failed(errorcode.BadArgument, "missing argument or invalid argument")) return } diff --git a/scanner/internal/event/agent_check_cache.go b/scanner/internal/event/agent_check_cache.go index a838d50..bda0c42 100644 --- a/scanner/internal/event/agent_check_cache.go +++ b/scanner/internal/event/agent_check_cache.go @@ -47,7 +47,7 @@ func (t *AgentCheckCache) TryMerge(other Event) bool { func (t *AgentCheckCache) Execute(execCtx ExecuteContext) { log := logger.WithType[AgentCheckCache]("Event") - log.Debugf("begin with %v", logger.FormatStruct(t)) + log.Debugf("begin with %v", logger.FormatStruct(t.AgentCheckCache)) defer log.Debugf("end") // TODO unavailable的节点需不需要发送任务? diff --git a/scanner/internal/event/agent_check_state.go b/scanner/internal/event/agent_check_state.go index 314059f..bd24769 100644 --- a/scanner/internal/event/agent_check_state.go +++ b/scanner/internal/event/agent_check_state.go @@ -37,7 +37,7 @@ func (t *AgentCheckState) TryMerge(other Event) bool { func (t *AgentCheckState) Execute(execCtx ExecuteContext) { log := logger.WithType[AgentCheckState]("Event") - log.Debugf("begin with %v", logger.FormatStruct(t)) + log.Debugf("begin with %v", logger.FormatStruct(t.AgentCheckState)) defer log.Debugf("end") mutex, err := reqbuilder.NewBuilder(). diff --git a/scanner/internal/event/agent_check_storage.go b/scanner/internal/event/agent_check_storage.go index 26670c9..02854e4 100644 --- a/scanner/internal/event/agent_check_storage.go +++ b/scanner/internal/event/agent_check_storage.go @@ -47,7 +47,7 @@ func (t *AgentCheckStorage) TryMerge(other Event) bool { func (t *AgentCheckStorage) Execute(execCtx ExecuteContext) { log := logger.WithType[AgentCheckStorage]("Event") - log.Debugf("begin with %v", logger.FormatStruct(t)) + log.Debugf("begin with %v", logger.FormatStruct(t.AgentCheckStorage)) defer log.Debugf("end") // 读取数据的地方就不加锁了,因为check任务会反复执行,单次失败问题不大 diff --git a/scanner/internal/event/check_cache.go b/scanner/internal/event/check_cache.go index fd3c594..b4e95d2 100644 --- a/scanner/internal/event/check_cache.go +++ b/scanner/internal/event/check_cache.go @@ -35,7 +35,7 @@ func (t *CheckCache) TryMerge(other Event) bool { func (t *CheckCache) Execute(execCtx ExecuteContext) { log := logger.WithType[AgentCheckStorage]("Event") - log.Debugf("begin with %v", logger.FormatStruct(t)) + log.Debugf("begin with %v", logger.FormatStruct(t.CheckCache)) defer log.Debugf("end") mutex, err := reqbuilder.NewBuilder(). diff --git a/scanner/internal/event/check_package.go b/scanner/internal/event/check_package.go index 8f2c653..e93dc7a 100644 --- a/scanner/internal/event/check_package.go +++ b/scanner/internal/event/check_package.go @@ -29,7 +29,7 @@ func (t *CheckPackage) TryMerge(other Event) bool { func (t *CheckPackage) Execute(execCtx ExecuteContext) { log := logger.WithType[CheckPackage]("Event") - log.Debugf("begin with %v", logger.FormatStruct(t)) + log.Debugf("begin with %v", logger.FormatStruct(t.CheckPackage)) defer log.Debugf("end") // 检查对象是否没有被引用的时候,需要读取StoragePackage表 diff --git a/scanner/internal/event/check_rep_count.go b/scanner/internal/event/check_rep_count.go index 72f5f44..f5fe8ec 100644 --- a/scanner/internal/event/check_rep_count.go +++ b/scanner/internal/event/check_rep_count.go @@ -38,7 +38,7 @@ func (t *CheckRepCount) TryMerge(other Event) bool { func (t *CheckRepCount) Execute(execCtx ExecuteContext) { log := logger.WithType[CheckRepCount]("Event") - log.Debugf("begin with %v", logger.FormatStruct(t)) + log.Debugf("begin with %v", logger.FormatStruct(t.CheckRepCount)) defer log.Debugf("end") mutex, err := reqbuilder.NewBuilder().