style: prettier 格式化

This commit is contained in:
erio
2026-03-14 05:10:28 +08:00
parent bd1db1efd8
commit 6dd7583b6c
3 changed files with 5 additions and 17 deletions

View File

@@ -16,7 +16,8 @@ export async function PUT(request: NextRequest, { params }: { params: Promise<{
} }
// 确定最终 groupId如果传了 group_id 用传入值,否则用现有值 // 确定最终 groupId如果传了 group_id 用传入值,否则用现有值
const finalGroupId = body.group_id !== undefined ? (body.group_id ? Number(body.group_id) : null) : existing.groupId; const finalGroupId =
body.group_id !== undefined ? (body.group_id ? Number(body.group_id) : null) : existing.groupId;
// 必须绑定分组才能保存 // 必须绑定分组才能保存
if (finalGroupId === null || finalGroupId === undefined) { if (finalGroupId === null || finalGroupId === undefined) {
@@ -44,10 +45,7 @@ export async function PUT(request: NextRequest, { params }: { params: Promise<{
where: { id }, where: { id },
data: { groupId: null, forSale: false }, data: { groupId: null, forSale: false },
}); });
return NextResponse.json( return NextResponse.json({ error: '该分组在 Sub2API 中已被删除,已自动解绑,请重新选择分组' }, { status: 409 });
{ error: '该分组在 Sub2API 中已被删除,已自动解绑,请重新选择分组' },
{ status: 409 },
);
} }
if (body.price !== undefined && (typeof body.price !== 'number' || body.price <= 0 || body.price > 99999999.99)) { if (body.price !== undefined && (typeof body.price !== 'number' || body.price <= 0 || body.price > 99999999.99)) {

View File

@@ -29,15 +29,7 @@ export interface PlanInfo {
} }
/** 套餐信息展示Header + 价格 + 描述 + 倍率/限额 + 特性),不含操作按钮 */ /** 套餐信息展示Header + 价格 + 描述 + 倍率/限额 + 特性),不含操作按钮 */
export function PlanInfoDisplay({ export function PlanInfoDisplay({ plan, isDark, locale }: { plan: PlanInfo; isDark: boolean; locale: Locale }) {
plan,
isDark,
locale,
}: {
plan: PlanInfo;
isDark: boolean;
locale: Locale;
}) {
const unit = plan.validityUnit ?? 'day'; const unit = plan.validityUnit ?? 'day';
const periodLabel = formatValidityLabel(plan.validityDays, unit, locale); const periodLabel = formatValidityLabel(plan.validityDays, unit, locale);
const periodSuffix = formatValiditySuffix(plan.validityDays, unit, locale); const periodSuffix = formatValiditySuffix(plan.validityDays, unit, locale);

View File

@@ -689,9 +689,7 @@ export async function executeSubscriptionFulfillment(orderId: string): Promise<v
let renewedSubscriptionId: number | undefined; let renewedSubscriptionId: number | undefined;
const userSubs = await getUserSubscriptions(order.userId); const userSubs = await getUserSubscriptions(order.userId);
const activeSub = userSubs.find( const activeSub = userSubs.find((s) => s.group_id === order.subscriptionGroupId && s.status === 'active');
(s) => s.group_id === order.subscriptionGroupId && s.status === 'active',
);
if (activeSub) { if (activeSub) {
// 续费:从到期日往后推算天数 // 续费:从到期日往后推算天数