feat(pdd-sync): 默认拉取已发货订单并支持配置单次拉单上限与抓取状态
This commit is contained in:
@@ -6,15 +6,18 @@
|
||||
import type { JsonObject } from '../../types/json.js'
|
||||
import { logInfo } from '../../utils/logger.js'
|
||||
import { syncAllPddStores } from '../platforms/pdd/pdd-sync-service.js'
|
||||
import { getPddSourcesConfig } from '../platforms/pdd/pdd-source-config-service.js'
|
||||
|
||||
export async function runPddOrderSyncJob(job: JsonObject) {
|
||||
const config =
|
||||
job.config && typeof job.config === 'object' && !Array.isArray(job.config)
|
||||
? (job.config as JsonObject)
|
||||
: {}
|
||||
const pageSize = Math.min(50, Math.max(1, Number(config.pageSize || 10)))
|
||||
const sourcesConfig = getPddSourcesConfig()
|
||||
const pageSize = Math.min(100, Math.max(1, Number(config.pageSize || sourcesConfig.pageSize || 50)))
|
||||
const orderType = Number(config.orderType ?? sourcesConfig.orderType ?? 2)
|
||||
|
||||
const syncResult = await syncAllPddStores({ pageSize })
|
||||
const syncResult = await syncAllPddStores({ pageSize, orderType })
|
||||
|
||||
if (!syncResult.enabled) {
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user