Remove Chinese comments from currency validation code

This commit is contained in:
1921703654 2025-09-03 02:34:31 +08:00
parent 0b6f9bb026
commit 39cd484036
2 changed files with 0 additions and 6 deletions

View File

@ -13,7 +13,6 @@ export const purchaseController: RequestHandler = async (req, res) => {
try {
const inventory = await getInventory(accountId);
// 记录购买前的货币状态
const beforePurchase = {
RegularCredits: inventory.RegularCredits,
PremiumCredits: inventory.PremiumCredits,
@ -26,7 +25,6 @@ export const purchaseController: RequestHandler = async (req, res) => {
const response = await handlePurchase(purchaseRequest, inventory);
await inventory.save();
// 记录购买后的货币状态
const afterPurchase = {
RegularCredits: inventory.RegularCredits,
PremiumCredits: inventory.PremiumCredits,
@ -37,7 +35,6 @@ export const purchaseController: RequestHandler = async (req, res) => {
res.json(response);
// 立即发送货币更新广播,确保客户端实时同步
sendWsBroadcastTo(accountId, {
update_inventory: true,
currency_update: {
@ -50,7 +47,6 @@ export const purchaseController: RequestHandler = async (req, res) => {
} catch (error) {
logger.error(`Purchase failed for account ${accountId}:`, error);
// 返回详细的错误信息给客户端
if (error instanceof Error && error.message.includes('Insufficient')) {
res.status(400).json({
error: 'INSUFFICIENT_CURRENCY',

View File

@ -1259,7 +1259,6 @@ export const updateCurrency = (
): IInventoryChanges => {
if (price != 0 && isCurrencyTracked(inventory, usePremium)) {
if (usePremium) {
// 验证白金余额是否足够
if (validateBalance) {
const totalPlatinum = inventory.PremiumCredits + inventory.PremiumCreditsFree;
if (totalPlatinum < price) {
@ -1278,7 +1277,6 @@ export const updateCurrency = (
inventory.PremiumCredits -= price;
logger.debug(`currency changes `, { PremiumCredits: -price });
} else {
// 验证现金余额是否足够
if (validateBalance && inventory.RegularCredits < price) {
throw new Error(`Insufficient credits balance. Required: ${price}, Available: ${inventory.RegularCredits}`);
}