Skip to content

Commit

Permalink
Fix the use of distributed event bus
Browse files Browse the repository at this point in the history
  • Loading branch information
gdlcf88 committed Aug 3, 2023
1 parent 4c46e5b commit f1bdf72
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion common.props
@@ -1,7 +1,7 @@
<Project>
<PropertyGroup>
<LangVersion>latest</LangVersion>
<Version>0.10.0</Version>
<Version>0.10.1</Version>
<NoWarn>$(NoWarn);CS1591</NoWarn>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Authors>EasyAbp Team</Authors>
Expand Down
Expand Up @@ -45,23 +45,24 @@ public virtual async Task<GiftCard> GetUsableAsync(string code, string password)
return giftCard;
}

public virtual async Task ConsumeAsync(GiftCard giftCard, Guid? userId, ExtraPropertyDictionary extraProperties = null)
public virtual async Task ConsumeAsync(GiftCard giftCard, Guid? userId,
ExtraPropertyDictionary extraProperties = null)
{
var template = await _giftCardTemplateRepository.GetAsync(giftCard.GiftCardTemplateId);

giftCard.Consume(_clock, userId, extraProperties);

await _repository.UpdateAsync(giftCard, true);

_unitOfWorkManager.Current.OnCompleted(async () => await _distributedEventBus.PublishAsync(
await _distributedEventBus.PublishAsync(
new GiftCardConsumedEto
{
GiftCardTemplateName = template.Name,
GiftCardTemplateExtraProperties = template.ExtraProperties,
GiftCardCode = giftCard.Code,
GiftCardExtraProperties = giftCard.ExtraProperties,
ConsumptionUserId = userId
}));
});
}
}
}

0 comments on commit f1bdf72

Please sign in to comment.