mirror of
https://github.com/QuantumNous/new-api.git
synced 2026-03-30 02:25:00 +00:00
✨ chore: Improve subscription billing fallback and UI states
Add a lightweight active-subscription check to skip subscription pre-consume when none exist, reducing unnecessary transactions and locks. In the subscription UI, disable subscription-first options when no active plan is available, show the effective fallback to wallet with a clear notice, and distinguish “invalidated” from “expired” states. Update i18n strings across supported locales to reflect the new messages and status labels.
This commit is contained in:
@@ -323,6 +323,13 @@ func NewBillingSession(c *gin.Context, relayInfo *relaycommon.RelayInfo, preCons
|
||||
case "subscription_first":
|
||||
fallthrough
|
||||
default:
|
||||
hasSub, err := model.HasActiveUserSubscription(relayInfo.UserId)
|
||||
if err != nil {
|
||||
return nil, types.NewError(err, types.ErrorCodeQueryDataError, types.ErrOptionWithSkipRetry())
|
||||
}
|
||||
if !hasSub {
|
||||
return tryWallet()
|
||||
}
|
||||
session, err := trySubscription()
|
||||
if err != nil {
|
||||
if err.GetErrorCode() == types.ErrorCodeInsufficientUserQuota {
|
||||
|
||||
Reference in New Issue
Block a user