From c8118ec04932310fd8af74aa49631d155f666f54 Mon Sep 17 00:00:00 2001 From: lxy Date: Thu, 13 Mar 2025 16:40:51 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9getShipEntity=E6=96=B9?= =?UTF-8?q?=E6=B3=95=E8=8E=B7=E5=8F=96shipClazz?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- es/utils/shipClazz/index.js | 11 +++++++---- lib/utils/shipClazz/index.js | 11 +++++++---- src/utils/shipClazz/index.ts | 11 +++++++---- 3 files changed, 21 insertions(+), 12 deletions(-) diff --git a/es/utils/shipClazz/index.js b/es/utils/shipClazz/index.js index 0d37d08f..6952437b 100644 --- a/es/utils/shipClazz/index.js +++ b/es/utils/shipClazz/index.js @@ -63,10 +63,13 @@ export async function getShipEntity(shipServiceId, orderIds, context) { for (const e of entities) { const k = `${e}$system`; const row = system[k][0]; - if (row && row.sort > sort && await ShipClazzDict[e]?.available(shipServiceId, orderIds, context)) { - sort = row.sort; - entity = e; - entityId = row.id; + if (row && row.sort > sort) { + const clazz = await getShipClazz(e, row.id, context); + if (await clazz.available(shipServiceId, orderIds, context)) { + sort = row.sort; + entity = e; + entityId = row.id; + } } } if (entity) { diff --git a/lib/utils/shipClazz/index.js b/lib/utils/shipClazz/index.js index 30cec9c8..c8d75d1c 100644 --- a/lib/utils/shipClazz/index.js +++ b/lib/utils/shipClazz/index.js @@ -69,10 +69,13 @@ async function getShipEntity(shipServiceId, orderIds, context) { for (const e of entities) { const k = `${e}$system`; const row = system[k][0]; - if (row && row.sort > sort && await ShipClazzDict[e]?.available(shipServiceId, orderIds, context)) { - sort = row.sort; - entity = e; - entityId = row.id; + if (row && row.sort > sort) { + const clazz = await getShipClazz(e, row.id, context); + if (await clazz.available(shipServiceId, orderIds, context)) { + sort = row.sort; + entity = e; + entityId = row.id; + } } } if (entity) { diff --git a/src/utils/shipClazz/index.ts b/src/utils/shipClazz/index.ts index fc1691ac..b72a3637 100644 --- a/src/utils/shipClazz/index.ts +++ b/src/utils/shipClazz/index.ts @@ -95,10 +95,13 @@ export async function getShipEntity(shipServiceId: string, orderIds: string[], c for (const e of entities) { const k = `${e}$system` as keyof EntityDict['system']['Schema']; const row = system[k][0]; - if (row && row.sort > sort && await ShipClazzDict[e]?.available(shipServiceId, orderIds, context)) { - sort = row.sort; - entity = e; - entityId = row.id; + if (row && row.sort > sort) { + const clazz = await getShipClazz(e, row.id!, context); + if (await clazz.available(shipServiceId, orderIds, context)) { + sort = row.sort; + entity = e; + entityId = row.id; + } } }