From 9d604b5dd98cadd547c542e894ebb024e600ea58 Mon Sep 17 00:00:00 2001 From: stringadmin Date: Mon, 8 Jun 2026 16:07:01 +0800 Subject: [PATCH] Restore image generation charge to 20 credits --- src/billing.js | 5 ++--- src/routes/user.js | 6 +++--- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/billing.js b/src/billing.js index f14b94c..43422fd 100644 --- a/src/billing.js +++ b/src/billing.js @@ -21,9 +21,8 @@ const CREDIT_UNITS_PER_CREDIT = 100; const CREDITS_PER_CNY = 100; const CREDIT_UNITS_PER_CNY_CENT = 100; const CREDIT_UNITS_PER_CNY_MILL = 10; -const IMAGE_GENERATION_FLAT_COST_CNY = 20; -const IMAGE_GENERATION_FLAT_COST_CENTS = - IMAGE_GENERATION_FLAT_COST_CNY * CREDITS_PER_CNY * CREDIT_UNITS_PER_CREDIT; +const IMAGE_GENERATION_FLAT_COST_CREDITS = 20; +const IMAGE_GENERATION_FLAT_COST_CENTS = IMAGE_GENERATION_FLAT_COST_CREDITS * CREDIT_UNITS_PER_CREDIT; function creditsToCreditUnits(credits) { return Math.max(0, Math.round(Number(credits || 0) * CREDIT_UNITS_PER_CREDIT)); diff --git a/src/routes/user.js b/src/routes/user.js index 6fd39fe..26498af 100644 --- a/src/routes/user.js +++ b/src/routes/user.js @@ -136,7 +136,7 @@ function registerUserRoutes(router) { CASE WHEN billing_refunded = 1 THEN 0 WHEN cost_cents > 0 THEN cost_cents - WHEN status = 'completed' AND type = 'image' THEN 200000 + WHEN status = 'completed' AND type = 'image' THEN 2000 WHEN status = 'completed' AND type = 'video' THEN 50000 ELSE 0 END @@ -162,7 +162,7 @@ function registerUserRoutes(router) { resolution = params.resolution || params.quality || params.ratio || null; if (row.status === "completed") { if (row.type === "image") { - estimatedCents = 200000; + estimatedCents = 2000; } else if (row.type === "video") { const dur = params.duration || 5; const res = String(params.resolution || params.quality || "").toUpperCase(); @@ -209,7 +209,7 @@ function registerUserRoutes(router) { CASE WHEN billing_refunded = 1 THEN 0 WHEN cost_cents > 0 THEN cost_cents - WHEN status = 'completed' AND type = 'image' THEN 200000 + WHEN status = 'completed' AND type = 'image' THEN 2000 WHEN status = 'completed' AND type = 'video' THEN 50000 ELSE 0 END