优化
This commit is contained in:
@@ -97,7 +97,15 @@ export async function getDeliveryOrder(deliveryNo: string, customerId: string) {
|
||||
const response = await overseasHttp.get<ApiEnvelope<DeliveryOrderDetail>, ApiEnvelope<DeliveryOrderDetail>>(
|
||||
`/platform/v1/last-leg/delivery-orders/${encodeURIComponent(deliveryNo)}`, { params: { customerId, page: 1, size: 200 } },
|
||||
)
|
||||
return unwrapApiResponse(response)
|
||||
const detail = unwrapApiResponse(response)
|
||||
// Java Long values are serialized as decimal strings, including the version.
|
||||
const rawVersion: unknown = detail.order.version
|
||||
const version = typeof rawVersion === 'string' && /^(0|[1-9]\d*)$/.test(rawVersion)
|
||||
? Number(rawVersion) : rawVersion
|
||||
if (typeof version !== 'number' || !Number.isSafeInteger(version) || version < 0) {
|
||||
throw new Error('派送单缺少有效版本,请刷新后重试')
|
||||
}
|
||||
return { ...detail, order: { ...detail.order, version } }
|
||||
}
|
||||
|
||||
export async function listDeliveryReturnInboundOptions(deliveryNo: string, customerId: string) {
|
||||
|
||||
Reference in New Issue
Block a user