优化快手接单匹配
This commit is contained in:
@@ -201,6 +201,31 @@ export async function listKuaishouIndustryVouchersByOid(
|
||||
return result.rows
|
||||
}
|
||||
|
||||
export type KuaishouIndustryVoucherWorkOrderSyncSource = {
|
||||
oid: string
|
||||
raw_payload_json: string | Record<string, unknown>
|
||||
}
|
||||
|
||||
export async function listKuaishouIndustryVoucherWorkOrderSyncSources(
|
||||
limit = 100,
|
||||
): Promise<KuaishouIndustryVoucherWorkOrderSyncSource[]> {
|
||||
const result = await query<KuaishouIndustryVoucherWorkOrderSyncSource>(
|
||||
`
|
||||
SELECT oid, raw_payload_json
|
||||
FROM (
|
||||
SELECT DISTINCT ON (oid) oid, raw_payload_json, updated_at, id
|
||||
FROM kuaishou_industry_vouchers
|
||||
WHERE raw_payload_json ? 'body'
|
||||
ORDER BY oid, updated_at DESC, id DESC
|
||||
) AS latest_source
|
||||
ORDER BY updated_at DESC, id DESC
|
||||
LIMIT $1
|
||||
`,
|
||||
[normalizePositiveLimit(limit, 100)],
|
||||
)
|
||||
return result.rows
|
||||
}
|
||||
|
||||
export async function listKuaishouIndustryVouchersForSendCallbackRetry(
|
||||
limit = 100,
|
||||
maxAttempts = 8,
|
||||
|
||||
Reference in New Issue
Block a user