fix: cached folder props should ignore date and policy

pull/1239/head
HFO4 3 years ago
parent b1803fa51f
commit 91377f4676

@ -1,13 +1,13 @@
package conf
// BackendVersion 当前后端版本号
var BackendVersion = "3.5.0-beta2"
var BackendVersion = "3.5.0-beta.3"
// RequiredDBVersion 与当前版本匹配的数据库版本
var RequiredDBVersion = "3.5.0-beta1"
var RequiredDBVersion = "3.5.0-beta2"
// RequiredStaticVersion 与当前版本匹配的静态资源版本
var RequiredStaticVersion = "3.5.0-beta2"
var RequiredStaticVersion = "3.5.0-beta.3"
// IsPro 是否为Pro版本
var IsPro = "false"

@ -391,11 +391,6 @@ func (service *ItemPropertyService) GetProperty(ctx context.Context, c *gin.Cont
return serializer.Err(serializer.CodeNotFound, "对象不存在", err)
}
// 如果对象是目录, 先尝试返回缓存结果
if cacheRes, ok := cache.Get(fmt.Sprintf("folder_props_%d", res)); ok {
return serializer.Response{Data: cacheRes.(serializer.ObjectProps)}
}
folder, err := model.GetFoldersByIDs([]uint{res}, user.ID)
if err != nil {
return serializer.DBErr("找不到目录", err)
@ -404,6 +399,14 @@ func (service *ItemPropertyService) GetProperty(ctx context.Context, c *gin.Cont
props.CreatedAt = folder[0].CreatedAt
props.UpdatedAt = folder[0].UpdatedAt
// 如果对象是目录, 先尝试返回缓存结果
if cacheRes, ok := cache.Get(fmt.Sprintf("folder_props_%d", res)); ok {
res := cacheRes.(serializer.ObjectProps)
res.CreatedAt = props.CreatedAt
res.UpdatedAt = props.UpdatedAt
return serializer.Response{Data: res}
}
// 统计子目录
childFolders, err := model.GetRecursiveChildFolder([]uint{folder[0].ID},
user.ID, true)

Loading…
Cancel
Save