style(backend): 格式化代码并修复floating-promises以通过pre-push检查
This commit is contained in:
@@ -251,21 +251,15 @@ export async function listAdminKuaishouMatchSources(payload: JsonObject = {}) {
|
||||
for (const row of recentOrderItemsResult.rows) {
|
||||
const snapshot = safeParseJson(row.item_snapshot_json)
|
||||
const ksc = safeParseJson(snapshot.kuaishouSendCode)
|
||||
const sellerId = normalizeKuaishouMatchId(
|
||||
ksc.sellerId || row.shop_id || row.platform,
|
||||
)
|
||||
const sellerId = normalizeKuaishouMatchId(ksc.sellerId || row.shop_id || row.platform)
|
||||
const relItemId = normalizeKuaishouMatchId(
|
||||
ksc.relItemId || row.sku_code || snapshot.goodsId || snapshot.goods_id,
|
||||
)
|
||||
const itemTitle = String(
|
||||
ksc.itemTitle || snapshot.goodsName || snapshot.goods_name || row.sku_name || '',
|
||||
).trim()
|
||||
const relSkuId = normalizeKuaishouMatchId(
|
||||
ksc.relSkuId || snapshot.spec || row.sku_code,
|
||||
)
|
||||
const skuNick = String(
|
||||
ksc.skuNick || snapshot.spec || row.sku_name || '',
|
||||
).trim()
|
||||
const relSkuId = normalizeKuaishouMatchId(ksc.relSkuId || snapshot.spec || row.sku_code)
|
||||
const skuNick = String(ksc.skuNick || snapshot.spec || row.sku_name || '').trim()
|
||||
|
||||
if (!sellerId || (!relItemId && !itemTitle)) continue
|
||||
|
||||
|
||||
@@ -62,12 +62,8 @@ export async function syncWorkerOrdersForSourceOrder(
|
||||
const itemTitle =
|
||||
matchContext.itemTitle ||
|
||||
String(snapshot.goodsName || snapshot.goods_name || item.sku_name || '').trim()
|
||||
const relSkuId =
|
||||
matchContext.relSkuId ||
|
||||
String(snapshot.spec || item.sku_code || '').trim()
|
||||
const skuNick =
|
||||
matchContext.skuNick ||
|
||||
String(snapshot.spec || item.sku_name || '').trim()
|
||||
const relSkuId = matchContext.relSkuId || String(snapshot.spec || item.sku_code || '').trim()
|
||||
const skuNick = matchContext.skuNick || String(snapshot.spec || item.sku_name || '').trim()
|
||||
|
||||
// Record product match diagnostics for all platform orders (including PDD)
|
||||
if (sellerId || relItemId || itemTitle) {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { APP_CONFIG_KEYS } from "../../config/app-config-keys.js"
|
||||
import type { JsonObject } from "../../types/json.js"
|
||||
import { readAppConfigEntry, saveAppConfigEntry } from "../config/app-config-store.js"
|
||||
import { pruneWorkProductMatchLogs } from "../../repositories/worker-platform/product-match-repo.js"
|
||||
import { APP_CONFIG_KEYS } from '../../config/app-config-keys.js'
|
||||
import type { JsonObject } from '../../types/json.js'
|
||||
import { readAppConfigEntry, saveAppConfigEntry } from '../config/app-config-store.js'
|
||||
import { pruneWorkProductMatchLogs } from '../../repositories/worker-platform/product-match-repo.js'
|
||||
|
||||
export type WorkerProductMatchConfig = {
|
||||
legacyFallbackEnabled: boolean
|
||||
@@ -50,7 +50,7 @@ export function normalizeWorkerProductMatchConfig(rawValue: unknown): WorkerProd
|
||||
return {
|
||||
// 默认关闭旧规则,避免大标题中的公共词触发错误接单。
|
||||
legacyFallbackEnabled:
|
||||
typeof source.legacyFallbackEnabled === "boolean" ? source.legacyFallbackEnabled : false,
|
||||
typeof source.legacyFallbackEnabled === 'boolean' ? source.legacyFallbackEnabled : false,
|
||||
// 匹配日志保留上限条数,默认 10000 条,0 为不限
|
||||
maxMatchLogs: Number.isInteger(maxLogs) && maxLogs >= 0 ? maxLogs : 10000,
|
||||
// 匹配日志保留天数,默认 30 天,0 为不限
|
||||
@@ -60,5 +60,5 @@ export function normalizeWorkerProductMatchConfig(rawValue: unknown): WorkerProd
|
||||
}
|
||||
|
||||
function isPlainObject(value: unknown): value is JsonObject {
|
||||
return Object.prototype.toString.call(value) === "[object Object]"
|
||||
return Object.prototype.toString.call(value) === '[object Object]'
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user