oss文件存储服务-租户存储空间信息同步接口优化
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user