lvhao 3 недель назад
Родитель
Сommit
ef8d223ae0
2 измененных файлов с 101 добавлено и 2 удалено
  1. 91 0
      core/CoreApp/controllers/Apiexpress.php
  2. 10 2
      core/CoreApp/models/Model_logic_tools.php

+ 91 - 0
core/CoreApp/controllers/Apiexpress.php

@@ -21,6 +21,8 @@ class Apiexpress extends Start_Controller {
         if($arg == 'search')
         if($arg == 'search')
         {
         {
             $this->search();
             $this->search();
+        }else if($arg == 'logistics'){
+            $this->_logistics();
         }
         }
         else{
         else{
             $this->_a();
             $this->_a();
@@ -571,5 +573,94 @@ class Apiexpress extends Start_Controller {
        die($this->logic_tools->ret_json(1,"success",$ret_arr));
        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;
+
+   }
     
     
 }
 }

+ 10 - 2
core/CoreApp/models/Model_logic_tools.php

@@ -36,7 +36,8 @@ class Model_logic_tools extends Lin_Model {
         $arr =  [
         $arr =  [
             2=>"asteriahair",
             2=>"asteriahair",
             3=>"alipearlhair",
             3=>"alipearlhair",
-            4=>"westkis"
+            4=>"westkis",
+            6=>"wigginshair",
         ];
         ];
         if(!isset($arr[$shop])){
         if(!isset($arr[$shop])){
             return "";
             return "";
@@ -48,7 +49,7 @@ class Model_logic_tools extends Lin_Model {
    function  getOrderTable($shop){
    function  getOrderTable($shop){
         $tt = [];
         $tt = [];
         $smt = [];
         $smt = [];
-        $dlz = [3,4];
+        $dlz = [3,4,6];
         if(in_array($shop,$tt)){
         if(in_array($shop,$tt)){
             return "fullordertt";
             return "fullordertt";
         } 
         } 
@@ -88,4 +89,11 @@ class Model_logic_tools extends Lin_Model {
         }
         }
         return openssl_decrypt($encrypt,'AES-128-CBC',$key,0,$iv);
         return openssl_decrypt($encrypt,'AES-128-CBC',$key,0,$iv);
    }
    }
+
+   function writeCache($filename,$data){
+
+   }
+   function readCache($filename){
+    
+   }
 }
 }