diff --git a/messages/en.json b/messages/en.json index 66bae38..b03bd04 100644 --- a/messages/en.json +++ b/messages/en.json @@ -145,7 +145,7 @@ "topUp": "Top Up", "enterAmount": "Enter amount to top up", "quickAmounts": "Quick amounts", - "topUpNote": "Note: This is a development environment. No real payment will be processed.", + "topUpNote": "For any top-up issues, please contact qsongtianlun@gmail.com", "processing": "Processing...", "topUpNow": "Top Up Now", "cancel": "Cancel", diff --git a/messages/zh.json b/messages/zh.json index c65a381..291ca30 100644 --- a/messages/zh.json +++ b/messages/zh.json @@ -145,7 +145,7 @@ "topUp": "充值", "enterAmount": "请输入充值金额", "quickAmounts": "快捷金额", - "topUpNote": "注意:这是开发环境,不会进行真实的支付处理。", + "topUpNote": "充值遇到任何问题,请联系邮箱 qsongtianlun@gmail.com", "processing": "处理中...", "topUpNow": "立即充值", "cancel": "取消", @@ -447,7 +447,6 @@ "runName": "运行名称", "cannotEditExecutedRun": "已运行的记录无法编辑", "runUpdated": "运行记录更新成功", - "selectModel": "选择模型", "execute": "执行", "executing": "执行中...", "generating": "生成中...", diff --git a/src/app/api/credits/topup/route.ts b/src/app/api/credits/topup/route.ts index 3b9eab3..c72305e 100644 --- a/src/app/api/credits/topup/route.ts +++ b/src/app/api/credits/topup/route.ts @@ -1,7 +1,5 @@ import { NextResponse } from 'next/server' import { createServerSupabaseClient } from '@/lib/supabase-server' -import { addCredit } from '@/lib/services/credit' -import { prisma } from '@/lib/prisma' export async function POST(request: Request) { try { @@ -31,53 +29,15 @@ export async function POST(request: Request) { return NextResponse.json({ error: 'Unauthorized' }, { status: 401 }) } - // 检查是否是开发环境 - const isDevelopment = process.env.NODE_ENV === 'development' - - if (isDevelopment) { - // 开发环境:模拟充值成功 - console.log(`🧪 Development mode: Simulating top-up of $${amount} for user ${user.id}`) - - // 确保用户存在于数据库中 - await prisma.user.upsert({ - where: { id: user.id }, - update: { - email: user.email || '', - updatedAt: new Date() - }, - create: { - id: user.id, - email: user.email || '', - username: user.user_metadata?.username || null, - subscriptionPlanId: 'free', - createdAt: new Date(), - updatedAt: new Date() - } - }) - - const creditTransaction = await addCredit( - user.id, - amount, - 'user_purchase', - `Development top-up: $${amount}`, - ) - - return NextResponse.json({ - success: true, - message: `Successfully topped up $${amount}`, - transaction: creditTransaction - }) - } else { - // 生产环境:重定向到 Stripe 支付 - return NextResponse.json( - { - success: false, - message: 'Please use Stripe payment for production', - redirectTo: '/api/credits/stripe-topup' - }, - { status:200 } - ) - } + // 统一重定向到 Stripe 支付 + return NextResponse.json( + { + success: false, + message: 'Please use Stripe payment', + redirectTo: '/api/credits/stripe-topup' + }, + { status: 200 } + ) } catch (error) { console.error('Top-up failed:', error)