Procházet zdrojové kódy

修改usps轨迹查询

longyi před 6 měsíci
rodič
revize
585ce9fccc

+ 5 - 1
core/CoreApp/controllers/Aatest.php

@@ -127,7 +127,11 @@ class Aatest extends Start_Controller {
 	public function _fout()
 	{
 		$waybill = $this->input->get('waybill');
-		$this->usps->get_new_logistics($waybill);
+		$info = $this->fullorder->get_waybill($waybill);
+			
+		$r = $this->usps->get_new_logistics($info);
+		echo "<pre>";
+		var_dump($r);
         //$this->fedexv1->makeAccessToken();
 		
 	}

+ 15 - 7
core/CoreApp/models/Model_usps.php

@@ -1036,6 +1036,7 @@ function __construct(){
 	public function get_new_logistics($info)//追踪快递
 	{	
 		$number = $info['waybill'];
+	
 		$token = $this->get_token();
 		
 		$url = 'https://apis.usps.com/tracking/v3/tracking/'.$number."?expand=DETAIL";
@@ -1062,15 +1063,22 @@ function __construct(){
 		$exstate = $this->usps_status->getState($res['statusSummary']);
 		
 		$content = date('Y-m-d H',time()).'-查询成功';
-		$xq = $info['excontent'];
+		$xq = '';
 		
-		if(isset($res['trackingEvents'][0])){
-			$tmp_express_str = $res['trackingEvents'][0]['eventTimestamp']."[".$res['trackingEvents'][0]['eventCity']."]".$res['statusSummary']."<br/>";
-		}else{
-			$tmp_express_str = "";
+		foreach($res['trackingEvents'] as $v){
+		    $tmp_time =date("Y-m-d H:i:s" ,(strtotime($v['eventTimestamp'])));
+            $tmp_express_str = $tmp_time." [".$v['eventCity']."]".$v['eventType']."<br />";
+            $xq = $xq.$tmp_express_str;
 		}
-		$list = array('exstate'=>$exstate,'content'=>$content,'f'=>1,'data'=>$xq,'s'=>$res);//正常可发送站内信
-		var_dump($list);	
+// 		if(isset($res['trackingEvents'][0])){
+// 		    $tmp_time =date("Y-m-d H:i:s" ,(strtotime($res['trackingEvents'][0]['eventTimestamp'])));
+// 			$tmp_express_str = $tmp_time." [".$res['trackingEvents'][0]['eventCity'] ." , ".$res['trackingEvents'][0]['eventType']."]".$res['statusSummary']."<br />";
+// 		}else{
+// 			$tmp_express_str = date("Y-m-d H:i:s")." [] ".$res['statusSummary']."<br />";
+// 		}
+		//$xq = $tmp_express_str.$xq;
+		$list = array('exstate'=>$exstate,'content'=>$content,'f'=>1,'data'=>trim($xq,'<br />'),'s'=>$res);//正常可发送站内信
+	    return $list;	
 		
 	}