feat(leader-skin): tag buy tx as LeaderSkinBuy for acquire history
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -177,7 +177,7 @@ public class LeaderSkinController : SVSimController
|
|||||||
if (!product.IsEnabled || product.Series is not { IsEnabled: true })
|
if (!product.IsEnabled || product.Series is not { IsEnabled: true })
|
||||||
return BadRequest(new { error = "product_not_available" });
|
return BadRequest(new { error = "product_not_available" });
|
||||||
|
|
||||||
await using var tx = await _inv.BeginAsync(viewerId, HttpContext.RequestAborted);
|
await using var tx = await _inv.BeginAsync(viewerId, HttpContext.RequestAborted, cfg => cfg.Source = GrantSource.LeaderSkinBuy);
|
||||||
|
|
||||||
// Already-purchased = viewer owns the leader_skin this product grants.
|
// Already-purchased = viewer owns the leader_skin this product grants.
|
||||||
if (tx.OwnsCosmetic(CosmeticType.Skin, product.LeaderSkinId))
|
if (tx.OwnsCosmetic(CosmeticType.Skin, product.LeaderSkinId))
|
||||||
@@ -230,7 +230,7 @@ public class LeaderSkinController : SVSimController
|
|||||||
if (!series.IsEnabled || series.SetSalesStatus == 0)
|
if (!series.IsEnabled || series.SetSalesStatus == 0)
|
||||||
return BadRequest(new { error = "set_sale_not_active" });
|
return BadRequest(new { error = "set_sale_not_active" });
|
||||||
|
|
||||||
await using var tx = await _inv.BeginAsync(viewerId, HttpContext.RequestAborted);
|
await using var tx = await _inv.BeginAsync(viewerId, HttpContext.RequestAborted, cfg => cfg.Source = GrantSource.LeaderSkinBuy);
|
||||||
|
|
||||||
if (tx.IsFreeplay)
|
if (tx.IsFreeplay)
|
||||||
return BadRequest(new { error = "already_purchased" });
|
return BadRequest(new { error = "already_purchased" });
|
||||||
@@ -286,7 +286,7 @@ public class LeaderSkinController : SVSimController
|
|||||||
if (existingClaim is not null)
|
if (existingClaim is not null)
|
||||||
return new LeaderSkinBuyResponse { RewardList = new() };
|
return new LeaderSkinBuyResponse { RewardList = new() };
|
||||||
|
|
||||||
await using var tx = await _inv.BeginAsync(viewerId, HttpContext.RequestAborted);
|
await using var tx = await _inv.BeginAsync(viewerId, HttpContext.RequestAborted, cfg => cfg.Source = GrantSource.LeaderSkinBuy);
|
||||||
|
|
||||||
// Must own every skin in the series to claim the bonus.
|
// Must own every skin in the series to claim the bonus.
|
||||||
bool ownsAll = series.Products.Count > 0 && series.Products.All(p => tx.OwnsCosmetic(CosmeticType.Skin, p.LeaderSkinId));
|
bool ownsAll = series.Products.Count > 0 && series.Products.All(p => tx.OwnsCosmetic(CosmeticType.Skin, p.LeaderSkinId));
|
||||||
|
|||||||
Reference in New Issue
Block a user