style(backend): 修复 4 个文件的 Prettier 格式告警
仅按仓库 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 通过。
This commit is contained in:
@@ -153,7 +153,6 @@ router.post(
|
||||
}),
|
||||
)
|
||||
|
||||
|
||||
router.post(
|
||||
'/cost-center/work-order-products/backfill',
|
||||
requireAdminPermission('finance.config'),
|
||||
|
||||
@@ -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 },
|
||||
]
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -1577,4 +1577,3 @@ export async function syncAdminProductPrice(productIdInput: unknown, session: Ad
|
||||
message: '该商品无需同步外部订单',
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user