| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- <?php
- defined('BASEPATH') OR exit('No direct script access allowed');
- class Thdj extends Lyapi_Controller{
- private $show_url = "https://lyerposs.wepolicy.cn";
- // 注意:登录接口不能受基础控制器的登录校验,可以覆盖构造方法或单独处理
- public function __construct() {
- // 这里不执行登录校验,只加载缓存驱动
- parent::__construct(); // 暂时注释,或者使用一个新的不校验的基类
- // 简便做法:复制 Lyapi_Controller 的部分代码但不调用 _check_api_auth
- // $this->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 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);
- }
- }
- }
|