lvhao 17 jam lalu
induk
melakukan
d5afbcced5
1 mengubah file dengan 48 tambahan dan 0 penghapusan
  1. 48 0
      core/CoreApp/controllers/Lyerpapi/v1/Outwarehouse.php

+ 48 - 0
core/CoreApp/controllers/Lyerpapi/v1/Outwarehouse.php

@@ -8,8 +8,56 @@ class Outwarehouse extends Lyapi_Controller{
         parent::__construct(); // 暂时注释,或者使用一个新的不校验的基类
         // 简便做法:复制 Lyapi_Controller 的部分代码但不调用 _check_api_auth
        // $this->load->driver('cache'); // 加载缓存驱动
+       $this->load->_model("Model_logic_order","logic_order");
     }
     public function ckct() {
         $this->_json_error("获取成功",200,[]);
     }
+
+    public function savescan(){
+        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['number'])){
+            $this->_json_error('参数错误','500');
+        }
+        $imglist = $data['imglist'];
+        if(empty($imglist)){
+            $this->_json_error('未上传出库图片','500');
+        }
+        $orderinfo = $this->logic_order->getInfo("number = '".$data['number']."'");
+
+        if(empty($orderinfo)){
+            $this->_json_error('订单不存在','500');
+        }
+        if($orderinfo['waybill'] != $data['waybill']){
+            $this->_json_error('运单号和数据库存储不一致','500');
+        }
+        $query = $this->db->get_where('scanimgs', ['number' => $data['number']]);
+        if($query->num_rows() > 0){
+            
+        }else{
+            $time = time();
+            $img_list = [
+                [
+                    "imgurl"=>[],
+                    "addtime"=>$time
+                ]
+            ];
+            $this->db->from('scanimgs')->insert(
+                [
+                    'number' => $orderinfo['number'],
+                    'shop'=>$orderinfo['shop'],
+                    'plat'=>$orderinfo['lv_platform'],
+                    'addtime'=>$time,
+                    "imgs"=>json_encode($img_list),
+                    'updatetime'=>$time,
+                ]
+            );
+        }
+
+    }
 }