lvhao 13 saat önce
ebeveyn
işleme
6c50745a5e

+ 54 - 0
core/CoreApp/controllers/Lyerpapi/v1/Order.php

@@ -9,6 +9,7 @@ class Order extends Lyapi_Controller{
         // 简便做法:复制 Lyapi_Controller 的部分代码但不调用 _check_api_auth
         // 简便做法:复制 Lyapi_Controller 的部分代码但不调用 _check_api_auth
        // $this->load->driver('cache'); // 加载缓存驱动
        // $this->load->driver('cache'); // 加载缓存驱动
        $this->load->_model("Model_logic_order","logic_order");
        $this->load->_model("Model_logic_order","logic_order");
+       $this->load->_model("Model_aliyunoss","aliyunoss");
     }
     }
 
 
     public function getinfo(){
     public function getinfo(){
@@ -51,5 +52,58 @@ class Order extends Lyapi_Controller{
         ]);
         ]);
         
         
     }
     }
+
+    public function getinfoscan(){
+        if($this->input->method(TRUE) != 'POST'){
+
+            $this->_json_error('请求方式错误','500');
+        }
+        $json_str = $this->input->raw_input_stream;
+        $data = json_decode($json_str,true);
+        if(empty($data['scancode'])){
+            $this->_json_error('参数错误','500');
+        }
+        $number = $data['scancode'];
+        if(stripos($number,'-') === false){
+            if(substr($number,0,3) == '788' && substr($number,-4,4) == '0430')//Fedex联邦
+            {
+                $number = substr($number,0,12);
+            }
+            if(strlen($number) == '34')//联邦杭州超长运单截取
+            {
+                $str  = substr($number, 0,3);
+                if($str == "420"){
+                    $number = substr($number,12);
+                }else{
+                    $number = substr($number,22,12);
+                }
+            }
+            $info = $this->logic_order->getInfo("waybill = '".$number."'");
+        }else{
+            $info = $this->logic_order->getInfo("number = '".$data['scancode']."'");
+        }
+        if(empty($info)){
+            $this->_json_error('未查询到订单信息','500');
+        }
+
+
+        if($data['qr'] != 'aliyuncheck'){
+            $this->_json_error('参数错误','500');
+        }
+        $res = $this->aliyunoss->getOssSignType("scanlibrary");
+        if($res['code'] == -1){
+            $this->_json_error($res["msg"],'500');
+        }else{
+            $this->_json_error('成功',200,[
+                'orderinfo'=>$info['orderinfo'],
+                'number'=>$info['number'],
+                'waybill'=>$info['waybill'],
+                'printtime'=>date("Y-m-d H:i",$info['printtime']),
+                'oss_config'=>$res['data']
+            ]);
+        }
+
+        
+    }
     
     
 }
 }