Procházet zdrojové kódy

提交小程序的测试

lvhao před 3 dny
rodič
revize
1960efdc6c
1 změnil soubory, kde provedl 34 přidání a 0 odebrání
  1. 34 0
      core/CoreApp/controllers/Lyerpapi/v1/Thdj.php

+ 34 - 0
core/CoreApp/controllers/Lyerpapi/v1/Thdj.php

@@ -42,4 +42,38 @@ class Thdj extends Lyapi_Controller{
         }
         $this->_json_error($info,'200');
     }
+
+    public function filesave(){
+        if($this->input->method(TRUE) != 'POST'){
+
+            $this->_json_error('请求方式错误','500');
+        }
+        $json_str = $this->input->raw_input_stream;
+        $data = json_decode($json_str,true);
+        $img = isset($data['img']) ? $data['img'] : '';
+        $torderinfo = isset($data['torderinfo']) ? $data['torderinfo'] : '';
+        $number = isset($data['number']) ? $data['number'] : '';
+        if(empty($img)){
+            $this->_json_error('图片不能为空','500');
+        }
+        if(empty($torderinfo)){
+            $this->_json_error('快递单号不能为空','500');
+        }
+        if(empty($number)){
+            $this->_json_error('订单号不能为空','500');
+        }
+        $info = $this->returns->find("torderinfo = '$torderinfo' and number = '$number'");
+        if(empty($info)){
+            $this->_json_error('未查询此快递相关的退货登记信息'.$torderinfo,'500');
+        }
+        $img_str = implode('|', $img);
+        $r = $this->returns->save([
+            'img'=>$img_str,
+        ],$info['id']);
+        if($r){
+            $this->_json_error('保存成功',200);
+        }else{
+            $this->_json_error('保存失败',500);
+        }
+    }
 }