From 73908119dc61fe0e9189e9971720369307312d9a Mon Sep 17 00:00:00 2001 From: yml2213 Date: Mon, 26 Oct 2026 12:13:08 +0800 Subject: [PATCH] =?UTF-8?q?style(backend):=20=E4=BF=AE=E5=A4=8D=204=20?= =?UTF-8?q?=E4=B8=AA=E6=96=87=E4=BB=B6=E7=9A=84=20Prettier=20=E6=A0=BC?= =?UTF-8?q?=E5=BC=8F=E5=91=8A=E8=AD=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 仅按仓库 Prettier 规则换行/去多余空行,无逻辑变更: - routes/admin/cost-center-catalog.ts - services/cost-center/affiliate-dash-prices-baseline.ts - services/cost-center/affiliate-product-service.ts - services/cost-center/product-catalog-service.ts 验证:backend format:check / typecheck / lint / check:sql 通过, tests 833 pass(3 skipped);frontend format:check 通过。 --- .../src/routes/admin/cost-center-catalog.ts | 1 - .../affiliate-dash-prices-baseline.ts | 21 ++++++++++-- .../cost-center/affiliate-product-service.ts | 33 +++++++------------ .../cost-center/product-catalog-service.ts | 1 - 4 files changed, 30 insertions(+), 26 deletions(-) diff --git a/apps/backend/src/routes/admin/cost-center-catalog.ts b/apps/backend/src/routes/admin/cost-center-catalog.ts index 4e9ca43f..207f0385 100644 --- a/apps/backend/src/routes/admin/cost-center-catalog.ts +++ b/apps/backend/src/routes/admin/cost-center-catalog.ts @@ -153,7 +153,6 @@ router.post( }), ) - router.post( '/cost-center/work-order-products/backfill', requireAdminPermission('finance.config'), diff --git a/apps/backend/src/services/cost-center/affiliate-dash-prices-baseline.ts b/apps/backend/src/services/cost-center/affiliate-dash-prices-baseline.ts index 9d965203..1d1e3c3a 100644 --- a/apps/backend/src/services/cost-center/affiliate-dash-prices-baseline.ts +++ b/apps/backend/src/services/cost-center/affiliate-dash-prices-baseline.ts @@ -18,8 +18,18 @@ export const AFFILIATE_DASH_PRICES_BASELINE: AffiliateDashPriceBaselineItem[] = { sku: 'honor_medal_x30', name: '荣耀勋章30个', category: '道具', costAmountFen: 3000 }, { sku: 'honor_medal_x2', name: '荣耀勋章2个', category: '道具', costAmountFen: 200 }, { sku: 'suit_cloud_bear', name: '套装-绵云熊熊', category: '套装', costAmountFen: 13480 }, - { sku: 'pack_star_roam_weapon', name: '星际漫游枪械礼包', category: '礼包', costAmountFen: 51600 }, - { sku: 'pack_star_roam_outfit', name: '星际漫游服装礼包', category: '礼包', costAmountFen: 83600 }, + { + sku: 'pack_star_roam_weapon', + name: '星际漫游枪械礼包', + category: '礼包', + costAmountFen: 51600, + }, + { + sku: 'pack_star_roam_outfit', + name: '星际漫游服装礼包', + category: '礼包', + costAmountFen: 83600, + }, { sku: 'suit_sand_dancer', name: '套装-狂沙舞者', category: '套装', costAmountFen: 8400 }, { sku: 'pack_lava_ranger', name: '熔岩游骑兵礼包', category: '礼包', costAmountFen: 9600 }, { sku: 'suit_panda_tuan', name: '套装-胖达团团', category: '套装', costAmountFen: 23400 }, @@ -41,7 +51,12 @@ export const AFFILIATE_DASH_PRICES_BASELINE: AffiliateDashPriceBaselineItem[] = { sku: 'suit_dual_fluffy', name: '套装-双彩绵绵', category: '套装', costAmountFen: 11240 }, { sku: 'bag_cute_bear', name: '萌熊伴侣背包', category: '背包', costAmountFen: 28800 }, { sku: 'm416_hamster_gray', name: 'M416-仓鼠灰灰', category: '枪械', costAmountFen: 16800 }, - { sku: 'top_black_elite_trainer', name: '黑色高级特训官上衣', category: '上衣', costAmountFen: 3600 }, + { + sku: 'top_black_elite_trainer', + name: '黑色高级特训官上衣', + category: '上衣', + costAmountFen: 3600, + }, { sku: 'suit_shadow_gothic', name: '套装-暗影哥特', category: '套装', costAmountFen: 8880 }, { sku: 'suit_alan_walker', name: '套装-Alan Walker', category: '套装', costAmountFen: 3600 }, ] diff --git a/apps/backend/src/services/cost-center/affiliate-product-service.ts b/apps/backend/src/services/cost-center/affiliate-product-service.ts index d30805c7..8790d4b6 100644 --- a/apps/backend/src/services/cost-center/affiliate-product-service.ts +++ b/apps/backend/src/services/cost-center/affiliate-product-service.ts @@ -282,10 +282,7 @@ export async function setAdminAffiliateProductPrice( id: number canonical_sku: string canonical_name: string - }>( - 'SELECT id, canonical_sku, canonical_name FROM product_catalog WHERE id = $1', - [productId], - ) + }>('SELECT id, canonical_sku, canonical_name FROM product_catalog WHERE id = $1', [productId]) const product = productResult.rows[0] if (!product) { throw createHttpError('商品不存在', { statusCode: 404 }) @@ -329,10 +326,11 @@ export async function setAdminAffiliateProductPrice( // 1. 金额未变,如果指定了更早的生效时间,则只更新生效时间 if (existing && Number(existing.amount_fen) === amountFen) { if (existingTime !== null && targetTime < existingTime) { - await query( - 'UPDATE cost_versions SET effective_from = $1, updated_at = $2 WHERE id = $3', - [effectiveFrom, now, existing.id], - ) + await query('UPDATE cost_versions SET effective_from = $1, updated_at = $2 WHERE id = $3', [ + effectiveFrom, + now, + existing.id, + ]) } return { success: true, @@ -389,15 +387,7 @@ export async function setAdminAffiliateProductPrice( ) RETURNING id `, - [ - costItem.id, - product.id, - amountFen, - effectiveFrom, - changeReason, - session.userId, - now, - ], + [costItem.id, product.id, amountFen, effectiveFrom, changeReason, session.userId, now], ) return { @@ -467,10 +457,11 @@ export async function importAdminAffiliateDashPricesBaseline(session: AdminSessi if (current && Number(current.amount_fen) === row.costAmountFen) { if (Date.parse(effectiveFrom) < Date.parse(current.effective_from)) { - await query( - 'UPDATE cost_versions SET effective_from = $1, updated_at = $2 WHERE id = $3', - [effectiveFrom, now, current.id], - ) + await query('UPDATE cost_versions SET effective_from = $1, updated_at = $2 WHERE id = $3', [ + effectiveFrom, + now, + current.id, + ]) updatedVersionCount += 1 } else { skippedCount += 1 diff --git a/apps/backend/src/services/cost-center/product-catalog-service.ts b/apps/backend/src/services/cost-center/product-catalog-service.ts index c62f5bba..e9da9556 100644 --- a/apps/backend/src/services/cost-center/product-catalog-service.ts +++ b/apps/backend/src/services/cost-center/product-catalog-service.ts @@ -1577,4 +1577,3 @@ export async function syncAdminProductPrice(productIdInput: unknown, session: Ad message: '该商品无需同步外部订单', } } -