Thdj.php 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. defined('BASEPATH') OR exit('No direct script access allowed');
  3. class Thdj extends Lyapi_Controller{
  4. private $show_url = "https://lyerposs.wepolicy.cn";
  5. // 注意:登录接口不能受基础控制器的登录校验,可以覆盖构造方法或单独处理
  6. public function __construct() {
  7. // 这里不执行登录校验,只加载缓存驱动
  8. parent::__construct(); // 暂时注释,或者使用一个新的不校验的基类
  9. // 简便做法:复制 Lyapi_Controller 的部分代码但不调用 _check_api_auth
  10. // $this->load->driver('cache'); // 加载缓存驱动
  11. $this->load->_model("Model_logic_order","logic_order");
  12. $this->load->_model("Model_returns","returns");
  13. $this->load->_model("Model_aliyunossnew","aliyunossnew");
  14. }
  15. public function searchwaybill(){
  16. if($this->input->method(TRUE) != 'POST'){
  17. $this->_json_error('请求方式错误','500');
  18. }
  19. $json_str = $this->input->raw_input_stream;
  20. $data = json_decode($json_str,true);
  21. $waybill = $data['waybill'];
  22. if(empty($waybill)){
  23. $this->_json_error('快递单号不能为空','500');
  24. }
  25. $waybill = $this->logic_order->getNeedWaybill($waybill);
  26. $info = $this->returns->find("torderinfo = '$waybill'");
  27. if(empty($info)){
  28. $this->_json_error('未查询到此快递单号'.$waybill,'500');
  29. }
  30. $res = $this->aliyunossnew->getOssSignType("shdjfile");
  31. if($res['code'] == -1){
  32. $this->_json_error($res["msg"],'500');
  33. }else{
  34. $this->_json_error('成功',200,[
  35. 'torderinfo'=>$info['torderinfo'],
  36. 'number'=>$info['number'],
  37. 'oss_config'=>$res['data']
  38. ]);
  39. }
  40. $this->_json_error($info,'200');
  41. }
  42. }