123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171 |
- <?php
- class Model_Usps_status extends Lin_Model {
- function __construct(){
- parent::__construct();
-
- }
-
- //获取快递状态
- public function getState($str,$zt,$dataprovince){
- $exstate = 0 ;
- if(
- (stripos($str,'delivered') !== false && stripos($str,'delivered by the expected delivery date') === false && stripos($str,'to be delivered') === false)
- ||
- stripos($str,'Your item was picked up at the post office') !== false
- || stripos($str,'Your item was picked up at') !== false
- )
- {
- $exstate = 6;
- $zx = 1;
- }
- else if(
- stripos($str,'out for delivery') !== false
- ||
- stripos($str,'Processing Exception')
- ||
- stripos($str,'was returned')
- ||
- stripos($str,'Delivery exception') !== false
- ||
- stripos($str,'Addressee Unknown') !== false
- ||
- stripos($str,'Delivered to Agent for Final Delivery') !== false
- ||
- stripos($str,'Reminder to pick up your item') !== false
- ||
- stripos($str,'Available for Pickup') !== false
- ||
- stripos($str,'Processing Exception') !== false
- ||
- stripos($str,'Return to Sender Processed') !== false
- ||
- stripos($str,'Redelivery Scheduled') !== false
- ||
- stripos($str,'Notice Left') !== false
- ||
- stripos($str,'Delivery attempted but no response at Consignee address') !== false
- ||
- stripos($str,'Delivery attempt could not be completed') !== false
- ||
- stripos($str,'Forwarded to a third party agent') !== false
- ||
- stripos($str,'Awaiting collection by the consignee') !== false
- ||
- stripos($str,'Consignee has moved from the address provided') !== false
- ||
- stripos($str,'awaiting customer pickup') !== false)
- {
- $exstate = 1;
- $zx = 1;
- }
- else if(
- stripos(strtolower($str),strtolower('Arrived at USPS Destination Facility')) !== false && stripos(strtolower($str),strtolower($dataprovince.' DISTRIBUTION CENTER')) !== false
- )
- {
- $exstate = 4;
- $zx = 1;
- }
- else if(stripos(strtolower($str),'In transit') !== false || stripos(strtolower($str),'picked up item') !== false)
- {
- $exstate = 3;
- $zx = 1;
- }
- else if(stripos(strtolower($str),'accepted at usps origin facility') !== false)
- {
- $exstate = 2;
- $zx = 1;
- }
- else
- {
- if(is_array($zt))
- {
- foreach($zt as $item)
- {
- $v =isset($item['eventType'])?$item['eventType']:"";
- if(
- stripos(strtolower($v),'out for delivery') !== false
- ||
- stripos(strtolower($v),'processing exception') !== false
- ||
- stripos($v,'Delivery exception') !== false
- ||
- stripos($v,'Addressee Unknown') !== false
- ||
- stripos($v,'Delivered to Agent for Final Delivery') !== false
- ||
- stripos($v,'Reminder to pick up your item') !== false
- ||
- stripos($v,'Available for Pickup') !== false
- ||
- stripos($v,'Processing Exception') !== false
- ||
- stripos($v,'Return to Sender Processed') !== false
- ||
- stripos($v,'Redelivery Scheduled') !== false
- ||
- stripos($v,'Notice Left') !== false
- ||
- stripos($v,'Delivery attempted but no response at Consignee address') !== false
- ||
- stripos($v,'Delivery attempt could not be completed') !== false
- ||
- stripos($v,'Forwarded to a third party agent') !== false
- ||
- stripos($v,'Awaiting collection by the consignee') !== false
- ||
- stripos($v,'Consignee has moved from the address provided') !== false
- ||
- stripos($v,'awaiting customer pickup') !== false
- )
- {
- $exstate = 1;
- break;
- }
- /**
- if(stripos(strtolower($v),strtolower($number['city'])) !== false && stripos(strtolower($v),'arrived at post office') !== false)
- {
- $exstate = 5;
- break;
- }
- **/
- else if(
- stripos(strtolower($v),strtolower('Arrived at USPS Destination Facility')) !== false
- &&
- stripos(strtolower($v),strtolower($dataprovince.' DISTRIBUTION CENTER')) !== false
- )
- {
- $exstate = 4;
- break;
- }
- if(
- stripos(strtolower($v),'In transit') !== false
- ||
- stripos(strtolower($v),'picked up item') !== false
- )
- {
- $exstate = 3;
- break;
- }
- if(stripos(strtolower($v),'accepted at usps origin facility') !== false)
- {
- $exstate = 2;
- break;
- }
- }
- }
- else
- {
- //这种情况基本没有 因为文档上返回的参数必须是数组,哪怕就一个状态也是数组
- $exstate = 1;
-
- }
-
- }
- return $exstate;
- }
-
-
- } //end class
|