oss文件存储服务-租户存储空间信息同步接口优化

This commit is contained in:
2025-12-30 18:45:37 +08:00
parent afe5d80f65
commit 17e7ae0437
8 changed files with 140 additions and 23 deletions

View File

@@ -26,10 +26,17 @@ func (d *tenantOssTotal) SaveOrUpdate(ctx context.Context, updateData []*entity.
if !g.IsEmpty(updateData) {
var filter, update []bson.M
for _, v := range updateData {
bsonm, err := mongo.EntityToBSONM(v)
if err != nil {
return err
}
filter = append(filter, bson.M{"tenantId": v.TenantId})
update = append(update, bson.M{"$set": bson.M{"usedOssSize": v.UsedOssSize, "totalOssSize": v.TotalOssSize}})
update = append(update, bson.M{"$set": bsonm})
}
_, err = MongoDAO.SaveOrUpdate(ctx, filter, update, consts.TenantOssTotalCollection)
if err != nil {
return err
}
_, err = mongo.DB().SaveOrUpdate(ctx, filter, update, consts.TenantOssTotalCollection)
}
return
}