删除旧履约配置逻辑
This commit is contained in:
@@ -17,13 +17,6 @@ type OrderPlatformLookupInput = {
|
||||
platformOrderId: string
|
||||
}
|
||||
|
||||
type OrderPlatformCandidateLookupInput = {
|
||||
provider?: string
|
||||
platform?: string
|
||||
shopIds?: unknown[]
|
||||
platformOrderId?: string
|
||||
}
|
||||
|
||||
export async function findOrderByPlatformOrderId({
|
||||
provider = '91kaquan',
|
||||
platform,
|
||||
@@ -43,34 +36,6 @@ export async function findOrderByPlatformOrderId({
|
||||
return result.rows[0] || null
|
||||
}
|
||||
|
||||
export async function findOrderByPlatformOrderIdCandidates({
|
||||
provider = '91kaquan',
|
||||
platform,
|
||||
shopIds = [],
|
||||
platformOrderId,
|
||||
}: OrderPlatformCandidateLookupInput): Promise<OrderRow | null> {
|
||||
const normalizedShopIds = [...new Set((Array.isArray(shopIds) ? shopIds : [])
|
||||
.map((item) => String(item || '').trim())
|
||||
.filter(Boolean))]
|
||||
|
||||
if (!platform || !platformOrderId || normalizedShopIds.length === 0) {
|
||||
return null
|
||||
}
|
||||
|
||||
const result = await query<OrderRow>(
|
||||
`
|
||||
SELECT *
|
||||
FROM orders
|
||||
WHERE provider = $1 AND platform = $2 AND shop_id = ANY($3::text[]) AND platform_order_id = $4
|
||||
ORDER BY id DESC
|
||||
LIMIT 1
|
||||
`,
|
||||
[provider, platform, normalizedShopIds, platformOrderId],
|
||||
)
|
||||
|
||||
return result.rows[0] || null
|
||||
}
|
||||
|
||||
export async function createOrder(input: OrderCreateInput): Promise<OrderRow | null> {
|
||||
const result = await query<OrderRow>(
|
||||
`
|
||||
|
||||
Reference in New Issue
Block a user