diff --git a/app/src/components/home/subscription/SubscriptionUsage.tsx b/app/src/components/home/subscription/SubscriptionUsage.tsx index ff62e40..0efd170 100644 --- a/app/src/components/home/subscription/SubscriptionUsage.tsx +++ b/app/src/components/home/subscription/SubscriptionUsage.tsx @@ -31,7 +31,8 @@ function SubscriptionUsage({ icon, name, usage }: UsageProps) { ) : (
-

{usage.used}

/

{usage.total}

+

{usage.used}

/{" "} +

{usage.total === -1 ? "∞" : usage.total}

)} diff --git a/app/src/dialogs/SubscriptionDialog.tsx b/app/src/dialogs/SubscriptionDialog.tsx index d23044c..c0ead88 100644 --- a/app/src/dialogs/SubscriptionDialog.tsx +++ b/app/src/dialogs/SubscriptionDialog.tsx @@ -67,7 +67,9 @@ function PlanItem({ level }: PlanItemProps) { {plan.items.map((item, index) => (
- {t("sub.plan-usage", { name: item.name, times: item.value })} + {item.value !== -1 + ? t("sub.plan-usage", { name: item.name, times: item.value }) + : t("sub.plan-unlimited-usage", { name: item.name })}

{t("sub.plan-tip")}

diff --git a/app/src/resources/i18n/cn.json b/app/src/resources/i18n/cn.json index 9aafde7..4854e16 100644 --- a/app/src/resources/i18n/cn.json +++ b/app/src/resources/i18n/cn.json @@ -203,6 +203,7 @@ "plan-price": "{{money}} 元/月", "include-tax": "含税", "plan-usage": "{{name}} 每月使用 {{times}} 次", + "plan-unlimited-usage": "{{name}} 无限次使用", "plan-tip": "可调用模型", "enterprise": "企业版", "enterprise-service": "优先技术支持", diff --git a/app/src/resources/i18n/en.json b/app/src/resources/i18n/en.json index f1f3cf4..c8e23ca 100644 --- a/app/src/resources/i18n/en.json +++ b/app/src/resources/i18n/en.json @@ -187,7 +187,8 @@ "migrate-failed-prompt": "Your subscription migration failed.", "plan-usage": "{{name}} uses {{times}} times per month", "plan-tip": "Callable Model", - "disable": "This site's subscription feature has been turned off" + "disable": "This site's subscription feature has been turned off", + "plan-unlimited-usage": "{{name}} has unlimited uses" }, "cancel": "Cancel", "confirm": "Confirm", diff --git a/app/src/resources/i18n/ja.json b/app/src/resources/i18n/ja.json index 1ea4baa..fc7c81d 100644 --- a/app/src/resources/i18n/ja.json +++ b/app/src/resources/i18n/ja.json @@ -187,7 +187,8 @@ "migrate-failed-prompt": "サブスクリプションの変更に失敗しました。", "plan-usage": "{{name}}は月に{{times}}回使用", "plan-tip": "呼び出し可能なモデル", - "disable": "このサイトのサブスクリプション機能はオフになっています" + "disable": "このサイトのサブスクリプション機能はオフになっています", + "plan-unlimited-usage": "{{name}}は無制限に使用できます" }, "cancel": "キャンセル", "confirm": "確認", diff --git a/app/src/resources/i18n/ru.json b/app/src/resources/i18n/ru.json index aa151d1..720b074 100644 --- a/app/src/resources/i18n/ru.json +++ b/app/src/resources/i18n/ru.json @@ -187,7 +187,8 @@ "migrate-failed-prompt": "Ваша подписка не удалась.", "plan-usage": "{{name}} использует {{times}} раз в месяц", "plan-tip": "Вызываемая модель", - "disable": "Функция подписки на этом сайте отключена" + "disable": "Функция подписки на этом сайте отключена", + "plan-unlimited-usage": "{{name}} имеет неограниченное количество пользователей" }, "cancel": "Отмена", "confirm": "Подтвердить", diff --git a/app/src/routes/admin/Subscription.tsx b/app/src/routes/admin/Subscription.tsx index 4e44c52..0cce545 100644 --- a/app/src/routes/admin/Subscription.tsx +++ b/app/src/routes/admin/Subscription.tsx @@ -462,6 +462,8 @@ function PlanConfig() {

{ formDispatch({ type: "set-item-value", diff --git a/channel/plan.go b/channel/plan.go index cbd605b..e5bddd0 100644 --- a/channel/plan.go +++ b/channel/plan.go @@ -225,10 +225,8 @@ func (p *PlanItem) IsExceeded(user globals.AuthLike, db *sql.DB, cache *redis.Cl } func (p *PlanItem) Increase(user globals.AuthLike, cache *redis.Client) bool { - if p.Value == -1 { - return true - } - return IncreaseSubscriptionUsage(cache, user, p.Id, p.Value) + state := IncreaseSubscriptionUsage(cache, user, p.Id, p.Value) + return state || p.IsInfinity() } func (p *PlanItem) Decrease(user globals.AuthLike, cache *redis.Client) bool {