style(backend): 格式化代码并修复floating-promises以通过pre-push检查

This commit is contained in:
yml2213
2026-09-12 17:46:47 +08:00
parent 8cc3aa2a35
commit fea82bff36
12 changed files with 55 additions and 71 deletions
@@ -219,19 +219,14 @@ export function normalizePddSourcesConfig(rawValue: unknown): PddSourcesConfig {
: 20
const rawOrderType = Number(source.orderType)
const orderType = Number.isInteger(rawOrderType) && [0, 1, 2].includes(rawOrderType)
? rawOrderType
: 2
const orderType =
Number.isInteger(rawOrderType) && [0, 1, 2].includes(rawOrderType) ? rawOrderType : 2
const rawPageSize = Number(source.pageSize)
const pageSize = Number.isInteger(rawPageSize)
? Math.min(100, Math.max(10, rawPageSize))
: 50
const pageSize = Number.isInteger(rawPageSize) ? Math.min(100, Math.max(10, rawPageSize)) : 50
const rawMaxPages = Number(source.maxPages)
const maxPages = Number.isInteger(rawMaxPages)
? Math.min(20, Math.max(1, rawMaxPages))
: 5
const maxPages = Number.isInteger(rawMaxPages) ? Math.min(20, Math.max(1, rawMaxPages)) : 5
return {
enabled: source.enabled !== false,
@@ -85,7 +85,10 @@ export async function syncStoreOrders(
const client = new PddClient(store)
const sourcesConfig = getPddSourcesConfig()
const pageSize = Math.min(100, Math.max(1, Number(options.pageSize || sourcesConfig.pageSize || 50)))
const pageSize = Math.min(
100,
Math.max(1, Number(options.pageSize || sourcesConfig.pageSize || 50)),
)
const initialPage = Math.max(1, Number(options.pageNumber || 1))
const orderType = options.orderType ?? sourcesConfig.orderType ?? 2 // 2: 已发货 (Shipped, default)
@@ -130,9 +133,7 @@ export async function syncStoreOrders(
totalFetched += items.length
// 提取本页订单号并批量排查数据库已有状态
const pageOrderSns = items
.map((item) => String(item.order_sn || '').trim())
.filter(Boolean)
const pageOrderSns = items.map((item) => String(item.order_sn || '').trim()).filter(Boolean)
const checkExisting =
options.checkExistingOrderIds ||
@@ -279,7 +280,7 @@ export async function syncStoreOrders(
lastCheckedAt: new Date().toISOString(),
}).catch(() => null)
notifyPddCookieExpired({
void notifyPddCookieExpired({
shopId,
shopName,
message: errMsg,