feat(pdd-sync): 默认拉取已发货订单并支持配置单次拉单上限与抓取状态

This commit is contained in:
yml2213
2026-09-12 15:16:39 +08:00
parent 121c2a452c
commit ffa3374483
8 changed files with 135 additions and 40 deletions
@@ -159,8 +159,15 @@ router.post(
'/pdd/sync',
createJsonHandler(
async (req) => {
const body = (req.body || {}) as { shopId?: string; pageSize?: number }
const body = (req.body || {}) as {
shopId?: string
pageSize?: number
orderType?: number
}
const shopId = String(body.shopId || '').trim()
const config = getPddSourcesConfig()
const pageSize = Math.min(100, Math.max(1, Number(body.pageSize || config.pageSize || 50)))
const orderType = Number(body.orderType ?? config.orderType ?? 2)
if (shopId) {
const store = getPddStoreById(shopId)
@@ -170,10 +177,10 @@ router.post(
errorCode: 'pdd_store_not_found',
})
}
return syncStoreOrders(store, { pageSize: body.pageSize || 10 })
return syncStoreOrders(store, { pageSize, orderType })
}
return syncAllPddStores({ pageSize: body.pageSize || 10 })
return syncAllPddStores({ pageSize, orderType })
},
{
successMessage: '拼多多同步已触发',