优化接单模板匹配
This commit is contained in:
@@ -49,6 +49,7 @@ export async function upsertWorkProductRuleMapping(input: {
|
||||
itemTitle: string
|
||||
relSkuId: string
|
||||
skuNick: string
|
||||
skuMatchMode: 'fuzzy' | 'exact'
|
||||
mappingType: 'product_default' | 'sku_exact' | 'sku_series'
|
||||
enabled: boolean
|
||||
now: string
|
||||
@@ -64,9 +65,10 @@ export async function upsertWorkProductRuleMapping(input: {
|
||||
item_title = $5,
|
||||
rel_sku_id = $6,
|
||||
sku_nick = $7,
|
||||
mapping_type = $8,
|
||||
enabled = $9,
|
||||
updated_at = $10
|
||||
sku_match_mode = $8,
|
||||
mapping_type = $9,
|
||||
enabled = $10,
|
||||
updated_at = $11
|
||||
WHERE id = $1
|
||||
RETURNING *
|
||||
`,
|
||||
@@ -78,6 +80,7 @@ export async function upsertWorkProductRuleMapping(input: {
|
||||
input.itemTitle,
|
||||
input.relSkuId,
|
||||
input.skuNick,
|
||||
input.skuMatchMode,
|
||||
input.mappingType,
|
||||
input.enabled,
|
||||
input.now,
|
||||
@@ -90,8 +93,8 @@ export async function upsertWorkProductRuleMapping(input: {
|
||||
`
|
||||
INSERT INTO work_product_rule_mappings (
|
||||
rule_id, seller_ids_json, rel_item_id, item_title, rel_sku_id, sku_nick,
|
||||
mapping_type, enabled, created_at, updated_at
|
||||
) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $9)
|
||||
sku_match_mode, mapping_type, enabled, created_at, updated_at
|
||||
) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $10)
|
||||
RETURNING *
|
||||
`,
|
||||
[
|
||||
@@ -101,6 +104,7 @@ export async function upsertWorkProductRuleMapping(input: {
|
||||
input.itemTitle,
|
||||
input.relSkuId,
|
||||
input.skuNick,
|
||||
input.skuMatchMode,
|
||||
input.mappingType,
|
||||
input.enabled,
|
||||
input.now,
|
||||
|
||||
@@ -168,6 +168,7 @@ export type WorkProductRuleMappingRow = {
|
||||
item_title: string
|
||||
rel_sku_id: string
|
||||
sku_nick: string
|
||||
sku_match_mode: 'fuzzy' | 'exact' | string
|
||||
mapping_type: 'product_default' | 'sku_exact' | 'sku_series' | string
|
||||
enabled: boolean
|
||||
created_at: string
|
||||
|
||||
@@ -680,6 +680,16 @@ export async function getWorkProductRuleByKey(ruleKey: string): Promise<WorkProd
|
||||
return result.rows[0] || null
|
||||
}
|
||||
|
||||
export async function getWorkProductRuleById(
|
||||
ruleId: number | string,
|
||||
): Promise<WorkProductRuleRow | null> {
|
||||
const result = await query<WorkProductRuleRow>(
|
||||
`${WORK_PRODUCT_RULE_SELECT} WHERE wpr.id = $1 LIMIT 1`,
|
||||
[Number(ruleId)],
|
||||
)
|
||||
return result.rows[0] || null
|
||||
}
|
||||
|
||||
export async function deleteWorkProductRule(
|
||||
ruleId: number | string,
|
||||
): Promise<{ deleted: boolean }> {
|
||||
|
||||
Reference in New Issue
Block a user