diff --git a/pkg/models/file.go b/pkg/models/file.go index 32b62ef..ff36f7a 100644 --- a/pkg/models/file.go +++ b/pkg/models/file.go @@ -54,7 +54,10 @@ func SetRedisFileInfo(fileId string, handler func(fileInfo *RedisFileInfo) *Redi old_fileInfo = &RedisFileInfo{} } fileInfo := handler(old_fileInfo) - jsonData, _ := json.Marshal(fileInfo) + jsonData, err := json.Marshal(fileInfo) + if err != nil { + return err + } return rdb.Do(ctx, rdb.B().Hset().Key("015:fileInfoMap").FieldValue().FieldValue(fileId, string(jsonData)).Build()).Error() } diff --git a/pkg/models/file_share_relational.go b/pkg/models/file_share_relational.go index 3e4fece..f7914bd 100644 --- a/pkg/models/file_share_relational.go +++ b/pkg/models/file_share_relational.go @@ -25,6 +25,9 @@ func GetRedisFileShareRelational(fileId string) ([]string, error) { func SetRedisFileShareRelational(fileId string, shareIDs []string) error { rdb, ctx := utils.GetRedisClient() - jsonData, _ := json.Marshal(shareIDs) + jsonData, err := json.Marshal(shareIDs) + if err != nil { + return err + } return rdb.Do(ctx, rdb.B().Hset().Key("015:fileShareRelational").FieldValue().FieldValue(fileId, string(jsonData)).Build()).Error() } diff --git a/pkg/models/share.go b/pkg/models/share.go index 5ae7f61..5e8f055 100644 --- a/pkg/models/share.go +++ b/pkg/models/share.go @@ -61,7 +61,10 @@ func SetRedisShareInfo(shareId string, handler func(shareInfo *RedisShareInfo) * old_shareInfo = &RedisShareInfo{} } shareInfo := handler(old_shareInfo) - jsonData, _ := json.Marshal(shareInfo) + jsonData, err := json.Marshal(shareInfo) + if err != nil { + return err + } return rdb.Do( ctx, rdb.B().Set(). diff --git a/pkg/models/stat.go b/pkg/models/stat.go index 3dbc75d..a1d0560 100644 --- a/pkg/models/stat.go +++ b/pkg/models/stat.go @@ -49,7 +49,10 @@ func SetRedisStat(key string, handler func(stat *StatData) *StatData) error { } } stat := handler(old_stat) - jsonData, _ := json.Marshal(stat) + jsonData, err := json.Marshal(stat) + if err != nil { + return err + } return rdb.Do(ctx, rdb.B().Hset().Key("015:stat").FieldValue().FieldValue(key, string(jsonData)).Build()).Error() }) } diff --git a/pkg/models/task.go b/pkg/models/task.go index a896ded..4531c9e 100644 --- a/pkg/models/task.go +++ b/pkg/models/task.go @@ -29,7 +29,10 @@ func GetRedisTaskInfo(taskId string) (*map[string]any, error) { func SetRedisTaskInfo(taskId string, taskInfo map[string]any) error { rdb, ctx := utils.GetRedisClient() - jsonData, _ := json.Marshal(taskInfo) + jsonData, err := json.Marshal(taskInfo) + if err != nil { + return err + } return rdb.Do( ctx, rdb.B().Set().Key(fmt.Sprintf("015:taskInfoMap:%s", taskId)).Value(string(jsonData)).Ex(time.Hour).Build(),