Express.php 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. namespace app\admin\controller;
  3. use think\App;
  4. class Express extends Base{
  5. public function __construct(App $app) {
  6. $this->noLogin = ["*"];
  7. parent::__construct($app);
  8. $this->model = new \app\admin\model\ExpressData();
  9. }
  10. public function List(){
  11. $param = $this->request->param(['outCode'=>"","outChildCode"=>"","orderCode"=>"","post_code"=>"","post_name"=>"",
  12. "status"=>"","page"=>1,"size"=>15],"post","trim");
  13. $where=[];
  14. if($param['outCode']!='') $where[]=['orderOut.outCode','like',"%".$param['outCode']."%"];
  15. if($param['outChildCode']!='') $where[]=['orderChild.outChildCode','like',"%".$param['outChildCode']."%"];
  16. if($param['orderCode']!='') $where[]=['orderOut.orderCode','like',"%".$param['orderCode']."%"];
  17. if($param['post_code']!='') $where[]=['express_data.post_code','like',"%".$param['post_code']."%"];
  18. if($param['post_name']!='') $where[]=['express_data.post_name','like',"%".$param['post_name']."%"];
  19. if($param['status']!='') $where[]=['express_data.status','=',$param['status']];
  20. $list = $this->model
  21. ->with(['OrderOut','OrderChild'])
  22. ->withJoin(["OrderOut","OrderChild"],"LEFT")
  23. ->where($where)
  24. ->order('id desc')
  25. ->paginate(["page"=>$param['page'],"list_rows"=>$param['size']])
  26. ->visible(["id","outCode","outChildCode","orderCode","post_name","post_code","post_data","post_logo","contactor",
  27. "mobile","status","dfStatus","ChStatus","post_express","remark","crontab_num","addtime","updatetime","send_status","sender"]);
  28. return success("获取成功",["list"=>$list->items(),"count"=>$list->total()]);
  29. }
  30. public function Info(){
  31. $param = $this->request->param(['id'=>0],"post","trim");
  32. $info = $this->model
  33. ->with(['OrderOut','OrderChild'])
  34. ->find($param['id']);
  35. return success("获取成功",$info);
  36. }
  37. }