diff --git a/src/app/admin/subscriptions/page.tsx b/src/app/admin/subscriptions/page.tsx
index 798bbc2..dfbce1c 100644
--- a/src/app/admin/subscriptions/page.tsx
+++ b/src/app/admin/subscriptions/page.tsx
@@ -4,6 +4,7 @@ import { useSearchParams } from 'next/navigation';
import { useState, useEffect, useCallback, Suspense } from 'react';
import PayPageLayout from '@/components/PayPageLayout';
import { resolveLocale, type Locale } from '@/lib/locale';
+import { PlatformBadge } from '@/lib/platform-style';
/* ---------- types ---------- */
@@ -28,6 +29,8 @@ interface SubscriptionPlan {
groupMonthlyLimit: number | null;
groupModelScopes: string[] | null;
productName: string | null;
+ groupAllowMessagesDispatch: boolean;
+ groupDefaultMappedModel: string | null;
}
interface Sub2ApiGroup {
@@ -37,6 +40,10 @@ interface Sub2ApiGroup {
daily_limit_usd: number | null;
weekly_limit_usd: number | null;
monthly_limit_usd: number | null;
+ platform: string | null;
+ rate_multiplier: number | null;
+ allow_messages_dispatch: boolean;
+ default_mapped_model: string | null;
}
interface Sub2ApiSubscription {
@@ -393,6 +400,13 @@ function SubscriptionsContent() {
fetchGroups();
}, [fetchPlans, fetchGroups]);
+ /* auto-fetch subs when switching to subs tab */
+ useEffect(() => {
+ if (activeTab === 'subs' && !subsSearched) {
+ fetchSubs();
+ }
+ }, [activeTab]);
+
/* --- modal helpers --- */
const openCreate = () => {
setEditingPlan(null);
@@ -401,8 +415,8 @@ function SubscriptionsContent() {
setFormDescription('');
setFormPrice('');
setFormOriginalPrice('');
- setFormValidDays('30');
- setFormValidUnit('day');
+ setFormValidDays('1');
+ setFormValidUnit('month');
setFormFeatures('');
setFormSortOrder('0');
setFormEnabled(true);
@@ -550,7 +564,7 @@ function SubscriptionsContent() {
/* --- fetch user subs --- */
const fetchSubs = async () => {
- if (!token || !subsUserId.trim()) return;
+ if (!token) return;
setSubsLoading(true);
setSubsSearched(true);
setSubsUser(null);
@@ -874,7 +888,7 @@ function SubscriptionsContent() {
{plan.groupPlatform && (
{t.platform}
-
{plan.groupPlatform}
+
)}
{plan.groupRateMultiplier != null && (
@@ -901,20 +915,30 @@ function SubscriptionsContent() {
{plan.groupMonthlyLimit != null ? `$${plan.groupMonthlyLimit}` : t.unlimited}
- {plan.groupModelScopes && plan.groupModelScopes.length > 0 && (
-
-
{t.modelScopes}
-
- {plan.groupModelScopes.map((m) => (
-
- {m}
+ {plan.groupPlatform?.toLowerCase() === 'openai' && (
+ <>
+
+
/v1/messages
+
+
+ {plan.groupAllowMessagesDispatch ? '✓' : '✗'}
- ))}
+
-
+ {plan.groupDefaultMappedModel && (
+
+
默认模型
+
+ {plan.groupDefaultMappedModel}
+
+
+ )}
+ >
)}
@@ -977,7 +1001,7 @@ function SubscriptionsContent() {