diff --git a/DysonNetwork.Pass/Wallet/SubscriptionController.cs b/DysonNetwork.Pass/Wallet/SubscriptionController.cs index 7d04f39..f262208 100644 --- a/DysonNetwork.Pass/Wallet/SubscriptionController.cs +++ b/DysonNetwork.Pass/Wallet/SubscriptionController.cs @@ -9,7 +9,8 @@ namespace DysonNetwork.Pass.Wallet; [ApiController] [Route("/api/subscriptions")] -public class SubscriptionController(SubscriptionService subscriptions, AfdianPaymentHandler afdian, AppDatabase db) : ControllerBase +public class SubscriptionController(SubscriptionService subscriptions, AfdianPaymentHandler afdian, AppDatabase db) + : ControllerBase { [HttpGet] [Authorize] @@ -48,7 +49,7 @@ public class SubscriptionController(SubscriptionService subscriptions, AfdianPay .Where(s => EF.Functions.ILike(s.Identifier, prefix + "%")) .OrderByDescending(s => s.BegunAt) .FirstOrDefaultAsync(); - if (subscription is null) return NotFound(); + if (subscription is null || !subscription.IsAvailable) return NotFound(); return Ok(subscription); } @@ -199,4 +200,4 @@ public class SubscriptionController(SubscriptionService subscriptions, AfdianPay return Ok(response); } -} +} \ No newline at end of file diff --git a/DysonNetwork.Pass/Wallet/SubscriptionService.cs b/DysonNetwork.Pass/Wallet/SubscriptionService.cs index c693324..d7a3b98 100644 --- a/DysonNetwork.Pass/Wallet/SubscriptionService.cs +++ b/DysonNetwork.Pass/Wallet/SubscriptionService.cs @@ -399,6 +399,7 @@ public class SubscriptionService( .Where(s => s.AccountId == accountId && identifiers.Contains(s.Identifier)) .OrderByDescending(s => s.BegunAt) .FirstOrDefaultAsync(); + if (subscription is { IsAvailable: false }) subscription = null; // Cache the result if found (with 5 minutes expiry) if (subscription != null)