| @@ -48,6 +48,7 @@ func (s *Server) initRouters() { | |||||
| s.engine.POST("/storage/loadPackage", s.StorageSvc().LoadPackage) | s.engine.POST("/storage/loadPackage", s.StorageSvc().LoadPackage) | ||||
| s.engine.POST("/storage/createPackage", s.StorageSvc().CreatePackage) | 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.POST("/cache/movePackage", s.CacheSvc().MovePackage) | ||||
| s.engine.GET("/cache/getPackageObjectCacheInfos", s.CacheSvc().GetPackageObjectCacheInfos) | s.engine.GET("/cache/getPackageObjectCacheInfos", s.CacheSvc().GetPackageObjectCacheInfos) | ||||
| @@ -128,8 +128,8 @@ func (s *StorageService) CreatePackage(ctx *gin.Context) { | |||||
| } | } | ||||
| type StorageGetInfoReq struct { | 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 { | type StorageGetInfoResp struct { | ||||
| @@ -140,8 +140,8 @@ func (s *StorageService) GetInfo(ctx *gin.Context) { | |||||
| log := logger.WithField("HTTP", "Storage.GetInfo") | log := logger.WithField("HTTP", "Storage.GetInfo") | ||||
| var req StorageGetInfoReq | 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")) | ctx.JSON(http.StatusBadRequest, Failed(errorcode.BadArgument, "missing argument or invalid argument")) | ||||
| return | return | ||||
| } | } | ||||
| @@ -47,7 +47,7 @@ func (t *AgentCheckCache) TryMerge(other Event) bool { | |||||
| func (t *AgentCheckCache) Execute(execCtx ExecuteContext) { | func (t *AgentCheckCache) Execute(execCtx ExecuteContext) { | ||||
| log := logger.WithType[AgentCheckCache]("Event") | 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") | defer log.Debugf("end") | ||||
| // TODO unavailable的节点需不需要发送任务? | // TODO unavailable的节点需不需要发送任务? | ||||
| @@ -37,7 +37,7 @@ func (t *AgentCheckState) TryMerge(other Event) bool { | |||||
| func (t *AgentCheckState) Execute(execCtx ExecuteContext) { | func (t *AgentCheckState) Execute(execCtx ExecuteContext) { | ||||
| log := logger.WithType[AgentCheckState]("Event") | 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") | defer log.Debugf("end") | ||||
| mutex, err := reqbuilder.NewBuilder(). | mutex, err := reqbuilder.NewBuilder(). | ||||
| @@ -47,7 +47,7 @@ func (t *AgentCheckStorage) TryMerge(other Event) bool { | |||||
| func (t *AgentCheckStorage) Execute(execCtx ExecuteContext) { | func (t *AgentCheckStorage) Execute(execCtx ExecuteContext) { | ||||
| log := logger.WithType[AgentCheckStorage]("Event") | 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") | defer log.Debugf("end") | ||||
| // 读取数据的地方就不加锁了,因为check任务会反复执行,单次失败问题不大 | // 读取数据的地方就不加锁了,因为check任务会反复执行,单次失败问题不大 | ||||
| @@ -35,7 +35,7 @@ func (t *CheckCache) TryMerge(other Event) bool { | |||||
| func (t *CheckCache) Execute(execCtx ExecuteContext) { | func (t *CheckCache) Execute(execCtx ExecuteContext) { | ||||
| log := logger.WithType[AgentCheckStorage]("Event") | 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") | defer log.Debugf("end") | ||||
| mutex, err := reqbuilder.NewBuilder(). | mutex, err := reqbuilder.NewBuilder(). | ||||
| @@ -29,7 +29,7 @@ func (t *CheckPackage) TryMerge(other Event) bool { | |||||
| func (t *CheckPackage) Execute(execCtx ExecuteContext) { | func (t *CheckPackage) Execute(execCtx ExecuteContext) { | ||||
| log := logger.WithType[CheckPackage]("Event") | 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") | defer log.Debugf("end") | ||||
| // 检查对象是否没有被引用的时候,需要读取StoragePackage表 | // 检查对象是否没有被引用的时候,需要读取StoragePackage表 | ||||
| @@ -38,7 +38,7 @@ func (t *CheckRepCount) TryMerge(other Event) bool { | |||||
| func (t *CheckRepCount) Execute(execCtx ExecuteContext) { | func (t *CheckRepCount) Execute(execCtx ExecuteContext) { | ||||
| log := logger.WithType[CheckRepCount]("Event") | 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") | defer log.Debugf("end") | ||||
| mutex, err := reqbuilder.NewBuilder(). | mutex, err := reqbuilder.NewBuilder(). | ||||