xml UPS跟踪Api和XML //在网站上显示跟踪状态
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了xml UPS跟踪Api和XML //在网站上显示跟踪状态相关的知识,希望对你有一定的参考价值。
<mvt:assign name="g.trackingURL" value="'https://www.ups.com/ups.app/xml/Track'" />
<mvt:assign name="l.key" value="'ACCESS-KEY'" />
<mvt:assign name="l.username" value="'USERNAME'" />
<mvt:assign name="l.password" value="'PASSWORD'" />
<mvt:assign name="l.trackingnum" value="'TRACKINGNUMBER'" />
<mvt:assign name="g.message" value="'
<?xml version=\"1.0\"?>
<AccessRequest xml:lang=\"en-US\">
<AccessLicenseNumber>' $ l.key $ '</AccessLicenseNumber>
<UserId>' $ l.username $ '</UserId>
<Password>' $ l.password $ '</Password>
</AccessRequest>
<?xml version=\"1.0\"?>
<TrackRequest xml:lang=\"en-US\">
<Request>
<TransactionReference>
<CustomerContext>My Description</CustomerContext>
<XpciVersion>1.0</XpciVersion>
</TransactionReference>
<RequestAction>Track</RequestAction>
<RequestOption>activity</RequestOption>
</Request>
<TrackingNumber>#' $ l.trackingnum $ '</TrackingNumber>
</TrackRequest>
'" />
<mvt:call action="g.trackingURL" method="'RAW'" fields="'message'" content-type="'text/xml; charset=utf-8'">
<mvt:assign name="l.settings:response" value="l.settings:response $ s.callvalue" />
</mvt:call>
<mvt:assign name="l.null" value="xml_parse_var(l.settings:response, l.settings:output)" />
<mvt:assign name="l.settings:xml_array" value="l.settings:output:TrackResponse:tags:Shipment[1]:tags:Package[1]:tags:Activity" />
<mvt:foreach iterator="arr" array="xml_array">
<mvt:assign name="l.settings:counter" value="l.settings:counter + 1" />
<mvt:assign name="l.settings:temp_array" value="NULL" />
<mvt:assign name="l.settings:temp_array:id" value="l.settings:counter" />
<mvt:assign name="l.settings:temp_array:date" value="l.settings:arr:tags:date[1]:value" />
<mvt:assign name="l.settings:temp_array:time" value="l.settings:arr:tags:time[1]:value" />
<mvt:assign name="l.settings:temp_array:descrip" value="l.settings:arr:tags:Status[1]:children[1]:tags:Description[1]:value" />
<mvt:assign name="l.settings:temp_array:city" value="l.settings:arr:tags:ActivityLocation[1]:tags:Address[1]:tags:City[1]:value" />
<mvt:assign name="l.settings:temp_array:country" value="l.settings:arr:tags:ActivityLocation[1]:tags:Address[1]:tags:CountryCode[1]:value" />
<mvt:assign name="l.settings:temp_array:state" value="l.settings:arr:tags:ActivityLocation[1]:tags:Address[1]:tags:StateProvinceCode[1]:value" />
<mvt:assign name="l.null" value="miva_array_insert(l.settings:upstrack, l.settings:temp_array, -1)" />
</mvt:foreach>
<style>
.details, .city {text-transform: capitalize;}
th, td {padding: 8px 5px; border-bottom: 1px solid #ccc;}
table {border-collapse: collapse;border-spacing: 0; width:100%}
</style>
<table>
<thead>
<tr>
<th>Date</th>
<th>Time</td>
<th>Location</td>
<th>Details</th>
</tr>
</thead>
<tbody>
<mvt:foreach iterator="ups" array="upstrack">
<mvt:if expr="l.settings:ups:time GT 130000">
<mvt:assign name="l.settings:ups:time" value="l.settings:ups:time - 130000" />
<mvt:assign name="l.settings:ups:ampm" value="'PM'" />
<mvt:else>
<mvt:assign name="l.settings:ups:ampm" value="'AM'" />
</mvt:if>
<mvt:assign name="l.settings:ups:time" value="padl(l.settings:ups:time, 6, 0)" />
<mvt:assign name="l.settings:ups:t_hour" value="substring_var( l.settings:ups:time, 1, 2 )" />
<mvt:if expr="l.settings:ups:t_hour EQ 0">
<mvt:assign name="l.settings:ups:t_hour" value="'01'" />
</mvt:if>
<mvt:assign name="l.settings:ups:t_minutes" value="substring_var( l.settings:ups:time, 3, 2 )" />
<mvt:assign name="l.settings:ups:d_yyyy" value="substring_var( l.settings:ups:date, 1, 4)" />
<mvt:assign name="l.settings:ups:d_mm" value="substring_var( l.settings:ups:date, 5, 2 )" />
<mvt:assign name="l.settings:ups:d_dd" value="substring_var( l.settings:ups:date, 7, 2 )" />
<mvt:if expr="l.settings:ups:d_mm EQ 1">
<mvt:assign name="l.settings:ups:d_mm" value="'Jan'"/>
<mvt:elseif expr="l.settings:ups:d_mm EQ 2">
<mvt:assign name="l.settings:ups:d_mm" value="'Feb'"/>
<mvt:elseif expr="l.settings:ups:d_mm EQ 3">
<mvt:assign name="l.settings:ups:d_mm" value="'Mar'"/>
<mvt:elseif expr="l.settings:ups:d_mm EQ 4">
<mvt:assign name="l.settings:ups:d_mm" value="'Apr'"/>
<mvt:elseif expr="l.settings:ups:d_mm EQ 5">
<mvt:assign name="l.settings:ups:d_mm" value="'May'"/>
<mvt:elseif expr="l.settings:ups:d_mm EQ 6">
<mvt:assign name="l.settings:ups:d_mm" value="'Jun'"/>
<mvt:elseif expr="l.settings:ups:d_mm EQ 7">
<mvt:assign name="l.settings:ups:d_mm" value="'Jul'"/>
<mvt:elseif expr="l.settings:ups:d_mm EQ 8">
<mvt:assign name="l.settings:ups:d_mm" value="'Aug'"/>
<mvt:elseif expr="l.settings:ups:d_mm EQ 9">
<mvt:assign name="l.settings:ups:d_mm" value="'Sep'"/>
<mvt:elseif expr="l.settings:ups:d_mm EQ 10">
<mvt:assign name="l.settings:ups:d_mm" value="'Oct'"/>
<mvt:elseif expr="l.settings:ups:d_mm EQ 11">
<mvt:assign name="l.settings:ups:d_mm" value="'Nov'"/>
<mvt:elseif expr="l.settings:ups:d_mm EQ 12">
<mvt:assign name="l.settings:ups:d_mm" value="'Dec'"/>
</mvt:if>
<tr>
<td>&mvt:ups:d_mm; &mvt:ups:d_dd;, &mvt:ups:d_yyyy;</td>
<td>&mvt:ups:t_hour;:&mvt:ups:t_minutes; &mvt:ups:ampm;</td>
<td><mvt:if expr="l.settings:ups:city"><span class="city"><mvt:eval expr="tolower(l.settings:ups:city)" /></span>,</mvt:if><mvt:if expr="l.settings:ups:state"> &mvt:ups:state;</mvt:if><mvt:if expr="l.settings:ups:country"> &mvt:ups:country;</mvt:if></td>
<td class="details"><mvt:if expr="'DELIVERED' cin l.settings:ups:descrip"><strong><mvt:eval expr="tolower(l.settings:ups:descrip)" /></strong><mvt:else><mvt:eval expr="tolower(l.settings:ups:descrip)" /></mvt:if></td>
</tr>
</mvt:foreach>
</tbody>
</table>
以上是关于xml UPS跟踪Api和XML //在网站上显示跟踪状态的主要内容,如果未能解决你的问题,请参考以下文章
FPS 和 UPS 有啥区别?我应该在游戏循环中跟踪 UPS 吗?