彻底重构-3
This commit is contained in:
@@ -64,10 +64,7 @@ export async function ensureFulfillmentCatalogBootstrapped() {
|
||||
}
|
||||
}
|
||||
|
||||
const configuredBindings = normalizeConfiguredBindings(runtimeConfig.orders?.fulfillmentBindings)
|
||||
const bindingsToApply = configuredBindings.length > 0
|
||||
? configuredBindings
|
||||
: inferDefaultBindingsFromSkuMappings(runtimeConfig.orders?.skuMappings)
|
||||
const bindingsToApply = normalizeConfiguredBindings(runtimeConfig.orders?.fulfillmentBindings)
|
||||
|
||||
for (const binding of bindingsToApply) {
|
||||
const profile = profileMap[binding.profileKey] || await getFulfillmentProfileByKey(binding.profileKey)
|
||||
@@ -108,19 +105,3 @@ function normalizeConfiguredBindings(bindings) {
|
||||
}))
|
||||
.filter((binding) => binding.skuCode)
|
||||
}
|
||||
|
||||
function inferDefaultBindingsFromSkuMappings(skuMappings) {
|
||||
const values = Object.values(skuMappings || {})
|
||||
const uniqueSkuCodes = [...new Set(values.map((value) => String(value || '').trim()).filter(Boolean))]
|
||||
|
||||
return uniqueSkuCodes.map((skuCode) => ({
|
||||
skuCode,
|
||||
provider: '',
|
||||
platform: '',
|
||||
shopId: '',
|
||||
profileKey: 'tencent_claim_redeem',
|
||||
enabled: true,
|
||||
priority: 100,
|
||||
config: {},
|
||||
}))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user