fix: 修复订阅列表API响应解析和管理后台messages调度字段缺失
1. listSubscriptions 解析 data.data.items 而非 data.data(Sub2API分页格式) 2. 管理后台套餐API返回 groupAllowMessagesDispatch 和 groupDefaultMappedModel
This commit is contained in:
@@ -44,6 +44,8 @@ export async function GET(request: NextRequest) {
|
|||||||
groupWeeklyLimit: group?.weekly_limit_usd ?? null,
|
groupWeeklyLimit: group?.weekly_limit_usd ?? null,
|
||||||
groupMonthlyLimit: group?.monthly_limit_usd ?? null,
|
groupMonthlyLimit: group?.monthly_limit_usd ?? null,
|
||||||
groupModelScopes: group?.supported_model_scopes ?? null,
|
groupModelScopes: group?.supported_model_scopes ?? null,
|
||||||
|
groupAllowMessagesDispatch: group?.allow_messages_dispatch ?? false,
|
||||||
|
groupDefaultMappedModel: group?.default_mapped_model ?? null,
|
||||||
productName: plan.productName ?? null,
|
productName: plan.productName ?? null,
|
||||||
createdAt: plan.createdAt,
|
createdAt: plan.createdAt,
|
||||||
updatedAt: plan.updatedAt,
|
updatedAt: plan.updatedAt,
|
||||||
|
|||||||
@@ -272,11 +272,12 @@ export async function listSubscriptions(params?: {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const data = await response.json();
|
const data = await response.json();
|
||||||
|
const paginated = data.data ?? {};
|
||||||
return {
|
return {
|
||||||
subscriptions: (data.data ?? []) as Sub2ApiSubscription[],
|
subscriptions: (paginated.items ?? []) as Sub2ApiSubscription[],
|
||||||
total: data.total ?? 0,
|
total: paginated.total ?? 0,
|
||||||
page: data.page ?? 1,
|
page: paginated.page ?? 1,
|
||||||
page_size: data.page_size ?? 50,
|
page_size: paginated.page_size ?? 50,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user