|
@@ -2,6 +2,7 @@
|
|
|
class Model_Usps extends Lin_Model {
|
|
|
function __construct(){
|
|
|
parent::__construct();
|
|
|
+ $this->load->_model("Model_logic_ding","logic_ding");
|
|
|
}
|
|
|
public function get_data($data)
|
|
|
{
|
|
@@ -1030,4 +1031,20 @@ function __construct(){
|
|
|
curl_close($ch);
|
|
|
return $result;
|
|
|
}
|
|
|
+
|
|
|
+ public function get_new_logistics($number)//追踪快递
|
|
|
+ {
|
|
|
+ $token = $this->get_token();
|
|
|
+
|
|
|
+ $url = 'https://api.usps.com/tracking/v3/tracking/'.$number;
|
|
|
+ $header = array('Authorization: Bearer '.$token,'Content-Type: application/json',"Accept: application/vnd.usps.labels+json");
|
|
|
+ $res= $this->su_curl([
|
|
|
+ "expand"=>"DETAIL",
|
|
|
+ ],$url,$header,'http_build_query',$timeout=300,"GET",'');
|
|
|
+ if(is_string($res)){
|
|
|
+ $this->logic_ding->sendToDing("usps追踪1".$res);
|
|
|
+ }else{
|
|
|
+ $this->logic_ding->sendToDing("usps追踪2".json_encode($res));
|
|
|
+ }
|
|
|
+ }
|
|
|
} //end class
|