load->driver('cache'); // 加载缓存驱动 $this->load->_model("Model_logic_order","logic_order"); $this->load->_model("Model_returns","returns"); $this->load->_model("Model_aliyunossnew","aliyunossnew"); } public function searchwaybill(){ if($this->input->method(TRUE) != 'POST'){ $this->_json_error('请求方式错误','500'); } $json_str = $this->input->raw_input_stream; $data = json_decode($json_str,true); $waybill = $data['waybill']; if(empty($waybill)){ $this->_json_error('快递单号不能为空','500'); } $waybill = $this->logic_order->getNeedWaybill($waybill); $info = $this->returns->find("torderinfo = '$waybill'"); if(empty($info)){ $this->_json_error('未查询到此快递单号'.$waybill,'500'); } $res = $this->aliyunossnew->getOssSignType("shdjfile"); if($res['code'] == -1){ $this->_json_error($res["msg"],'500'); }else{ $this->_json_error('成功',200,[ 'torderinfo'=>$info['torderinfo'], 'number'=>$info['number'], 'oss_config'=>$res['data'] ]); } $this->_json_error($info,'200'); } public function thdjwjbc(){ 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_list = []; foreach($img as $k=>$v){ if(is_string($v)){ $img_str = str_replace($this->show_url, '', $v); }else{ $img_str = str_replace($this->show_url, '', $v['url']); } $img_list[] = $img_str; } $img_str = implode('|', $img_list); $r = $this->returns->save([ 'img'=>$img_str, ],$info['id']); if($r){ $this->_json_error('保存成功',200); }else{ $this->_json_error('保存失败',500); } } }