|
|
@@ -21,6 +21,8 @@ class Apiexpress extends Start_Controller {
|
|
|
if($arg == 'search')
|
|
|
{
|
|
|
$this->search();
|
|
|
+ }else if($arg == 'logistics'){
|
|
|
+ $this->_logistics();
|
|
|
}
|
|
|
else{
|
|
|
$this->_a();
|
|
|
@@ -571,5 +573,94 @@ class Apiexpress extends Start_Controller {
|
|
|
die($this->logic_tools->ret_json(1,"success",$ret_arr));
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 检索订单的物流信息 不含订单状态
|
|
|
+ */
|
|
|
+ public function _logistics(){
|
|
|
+ $data = file_get_contents('PHP://input');
|
|
|
+ $data = json_decode($data, true);
|
|
|
+ $shop = isset($data['shop'])?$data['shop']:"";
|
|
|
+ $waybill_no = isset($data['order_no'])?$data['order_no']:"";
|
|
|
+ $apply_time = isset($data['time'])?$data['time']:0;
|
|
|
+
|
|
|
+ $jiami_str = isset($data['key'])?$data['key']:"";
|
|
|
+
|
|
|
+ $now_time = time();
|
|
|
+ if(strlen( $apply_time."") != 10){
|
|
|
+ echo json_encode(array('track'=>'','msg'=>'apply time format exception','success'=>0));exit;
|
|
|
+ }
|
|
|
+ if(empty($shop)){
|
|
|
+ echo json_encode(array('track'=>'','msg'=>'The shop cannot be empty','success'=>0));exit;
|
|
|
+ }
|
|
|
+ $shop_key = $this->logic_tools->getshopname($shop);
|
|
|
+ if(empty($jiami_str)){
|
|
|
+ echo json_encode(array('track'=>'','msg'=>'This store has not configured any parameters','success'=>0));exit;
|
|
|
+ }
|
|
|
+ $jiemi_str = $this->logic_tools->toolsjiemi($jiami_str,$this->key,$this->iv);
|
|
|
+ if(empty($shop_key)){
|
|
|
+ echo json_encode(array('track'=>'','msg'=>'This shop has not configured any parameters','success'=>0));exit;
|
|
|
+ }
|
|
|
+ $jiemi_arr = explode("+",$jiemi_str);
|
|
|
+ $jiemi_key = isset($jiemi_arr[0])?$jiemi_arr[0]:"";
|
|
|
+ $jiemi_time = isset($jiemi_arr[1])?$jiemi_arr[1]:"";
|
|
|
+ if((int)$jiemi_time != (int)$apply_time){
|
|
|
+ //Request exceeds the deadline
|
|
|
+ echo json_encode(array('track'=>'','msg'=>'Request exceeds the deadline','success'=>0));exit;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ if( $now_time - $apply_time > 100){
|
|
|
+ echo json_encode(array('track'=>'','msg'=>'Request exceeds the deadline','success'=>0));exit;
|
|
|
+ }
|
|
|
+ if($jiemi_key != $shop_key){
|
|
|
+ echo json_encode(array('track'=>'','msg'=>'The key of this shop is incorrect','success'=>0));exit;
|
|
|
+ }
|
|
|
+ if(empty($waybill_no) ){
|
|
|
+ echo json_encode(array('track'=>'','msg'=>'The tracking number requested for query cannot be empty','success'=>0));exit;
|
|
|
+ }
|
|
|
+ $table_name = $this->logic_tools->getOrderTable($shop);
|
|
|
+ if(empty($table_name)){
|
|
|
+ echo json_encode(array('track'=>'','msg'=>'The shop has not activated this feature!!!','success'=>0));exit;
|
|
|
+ }
|
|
|
+
|
|
|
+ $info = $this->logic_order->getInfoByTableName($table_name,"waybill = '".$waybill_no. "' and shop = ".$shop,"id,number,orderinfo,express,excontent,expressstate,waybill,dtime,printtime,client,name,country,province,city,address,address2,street,phone,zipcode,dlzemailtime,library,librarytime");
|
|
|
+
|
|
|
+ if(empty($info)){
|
|
|
+ $info = $this->logic_order->getInfoByTableName($table_name,"orderinfo = '".$shop.$waybill_no. "' and shop = ".$shop,"id,number,orderinfo,express,excontent,expressstate,waybill,dtime,printtime,client,name,country,province,city,address,address2,street,phone,zipcode,dlzemailtime,library,librarytime");
|
|
|
+ }
|
|
|
+
|
|
|
+ if(empty($info)){
|
|
|
+ echo json_encode(array('track'=>'','msg'=>'No logistics information','success'=>0));exit;
|
|
|
+ }
|
|
|
+
|
|
|
+ if(empty($info['excontent'])){
|
|
|
+ echo json_encode(array('track'=>'','msg'=>'No logistics information','success'=>0));exit;
|
|
|
+ }
|
|
|
+
|
|
|
+ if(strpos($info['excontent'],"[") !== false && strpos($info['excontent'],"]") !== false ){
|
|
|
+
|
|
|
+ }else{
|
|
|
+ echo json_encode(array('track'=>array('f'=>1,'data'=>$info['excontent']),'msg'=>'','success'=>1));exit;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ $tmp_arr = explode("<br />",$info['excontent']);
|
|
|
+ if(!empty($tmp_arr)){
|
|
|
+ $final_arr = [];
|
|
|
+ foreach($tmp_arr as $k => $v){
|
|
|
+ $one_tmp_arr = explode("[",$v);
|
|
|
+ $two_tmp_arr = explode("]",$one_tmp_arr[1]);
|
|
|
+ $final_arr[] = $two_tmp_arr[1]." [".$two_tmp_arr[0]."] ".$one_tmp_arr;
|
|
|
+ }
|
|
|
+ $final_str = implode("<br />",$final_arr);
|
|
|
+
|
|
|
+ ob_clean();
|
|
|
+ }else{
|
|
|
+ echo json_encode(array('track'=>'','msg'=>'Abnormal express delivery information','success'=>0));exit;
|
|
|
+ }
|
|
|
+ echo json_encode(array('track'=>array('f'=>1,'data'=>$final_str),'msg'=>'','success'=>1));exit;
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
}
|