添加消息队列消费者并优化租户存储总量更新逻辑
This commit is contained in:
@@ -17,16 +17,16 @@ type tenantOssTotal struct {
|
||||
}
|
||||
|
||||
// SaveOrUpdate 增加或更新
|
||||
func (d *tenantOssTotal) SaveOrUpdate(ctx context.Context, updateData []*entity.TenantOssTotal) (err error) {
|
||||
func (d *tenantOssTotal) SaveOrUpdate(ctx context.Context, updateData []*dto.UpdateUsedOssReq) (err error) {
|
||||
if !g.IsEmpty(updateData) {
|
||||
var filter, update []bson.M
|
||||
for _, v := range updateData {
|
||||
bsonm, err := mongo.EntityToBsonWithFilter(v, true)
|
||||
buildUpdateData, err := mongo.BuildUpdateData(ctx, v)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
filter = append(filter, bson.M{"tenantId": v.TenantId})
|
||||
update = append(update, bson.M{"$set": bsonm})
|
||||
update = append(update, bson.M{"$set": buildUpdateData})
|
||||
}
|
||||
_, err = MongoDAO.SaveOrUpdate(ctx, filter, update, consts.TenantOssTotalCollection)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user