我正在使用 UPS API ,并且 UPS API 的结果返回有问题。我得到的结果如下:
Array
(
[1] => Array
(
[value] => 9.90
[code] => 03
[delivery_day] => -1
[delivery_time] => -1
[currency_code] => USD
[old_currency_code] => USD
)
[2] => Array
(
[value] => 12.70
[code] => 12
[delivery_day] => 3
[delivery_time] => -1
[currency_code] => USD
[old_currency_code] => USD
)
)
哪个是完美的,但是当您在第一个数组中看到时,交货日期和时间显示值“-1”。在第二个数组传递日值为3,时间为“-1”。我需要知道它意味着什么?这真的令人困惑。请帮忙。
答案 0 :(得分:0)
答案取决于您使用的API:
最好不要引用UPS Developer Website及相关文档,从“Developer Kit — User Guide”的PDF开始
答案 1 :(得分:0)
由于您的阵列显示多个服务,我猜您正在运行费率,而不是货运。此外,正在发生一些其他转换,导致您看到的奇数值,因为您的代码必须将速率响应与转换响应合并,以便提供成本和传输时间。
以下是UPS的速率响应XML:
<RatedShipment>
<Service>
<Code>03</Code></Service>
<BillingWeight>
<UnitOfMeasurement><Code>KGS</Code></UnitOfMeasurement>
<Weight>23.0</Weight>
</BillingWeight>
<TransportationCharges>
<CurrencyCode>UKL</CurrencyCode>
<MonetaryValue>73.65</MonetaryValue>
</TransportationCharges>
<ServiceOptionsCharges>
<CurrencyCode>UKL</CurrencyCode>
<MonetaryValue>0.00</MonetaryValue>
</ServiceOptionsCharges>
<TotalCharges>
<CurrencyCode>UKL</CurrencyCode>
<MonetaryValue>73.65</MonetaryValue>
</TotalCharges>
<GuaranteedDaysToDelivery>0</GuaranteedDaysToDelivery>
<RatedPackage>
<TransportationCharges>
<CurrencyCode>UKL</CurrencyCode>
<MonetaryValue>0.00</MonetaryValue>
</TransportationCharges>
<ServiceOptionsCharges>
<CurrencyCode>UKL</CurrencyCode>
<MonetaryValue>0.00</MonetaryValue>
</ServiceOptionsCharges>
<TotalCharges>
<CurrencyCode>UKL</CurrencyCode>
<MonetaryValue>0.00</MonetaryValue>
</TotalCharges>
<Weight>23.0</Weight>
<BillingWeight>
<UnitOfMeasurement>
<Code>KGS</Code>
</UnitOfMeasurement>
<Weight>0.0</Weight>
</BillingWeight>
</RatedPackage>
</RatedShipment>
这是传输响应的部分片段:
<EstimatedArrival>
<BusinessTransitDays>1</BusinessTransitDays>
<Time>23:30:00</Time>
<PickupDate>2001-06-08</PickupDate>
<PickupTime>19:00:00</PickupTime>
<HolidayCount>0</HolidayCount>
<DelayCount>0</DelayCount>
<Date>2001-06-11</Date>
<DayOfWeek>MON</DayOfWeek>
<TotalTransitDays>2</TotalTransitDays>
<CustomerCenterCutoff>18:30:00</CustomerCenterCutoff>
<RestDays>1</RestDays>
</EstimatedArrival>