feat(cost-center): 统一接单模板成本并自动同步商品
This commit is contained in:
@@ -275,21 +275,13 @@ test('mapping lookup follows specificity and concrete-shop priority', () => {
|
||||
)
|
||||
})
|
||||
|
||||
/**
|
||||
* 2026-10-29 生产:改「接单模板」商品价格 500。
|
||||
*
|
||||
* PostgreSQL 报 `inconsistent types deduced for parameter $1`(integer versus bigint):
|
||||
* 同一个 $1 在 `reward_amount = $1` 处按 bigint 推断,在 `CASE ... THEN $1 ELSE 0`
|
||||
* 处又因为 `0` 是 integer 被推断成 integer。node-pg 不发送参数类型,必须显式转换。
|
||||
*/
|
||||
test('接单模板改价 SQL 的参数必须显式指定 bigint', async () => {
|
||||
test('接单模板改价必须在同一事务中同步成本版本与模板投影', async () => {
|
||||
const { readFile } = await import('node:fs/promises')
|
||||
const source = await readFile(new URL('./product-catalog-service.ts', import.meta.url), 'utf8')
|
||||
assert.ok(
|
||||
source.includes(
|
||||
'unit_price_fen = CASE WHEN unit_price_fen > 0 THEN $1::bigint ELSE 0::bigint END',
|
||||
),
|
||||
)
|
||||
assert.ok(source.includes('const costVersionId = await withTransaction'))
|
||||
assert.ok(source.includes('reward_amount = $1::bigint'))
|
||||
assert.ok(source.includes('unit_price_fen = $2::bigint'))
|
||||
assert.ok(source.includes('cost_work_order_future_price_not_supported'))
|
||||
})
|
||||
|
||||
test('成本模型与商品来源必须覆盖第三方卡券渠道', () => {
|
||||
|
||||
Reference in New Issue
Block a user