post = request()->post(); } public function list(){ $page = isset($this->post['page']) &&$this->post['page'] !=="" ? intval($this->post['page']):1; $size = isset($this->post['size']) &&$this->post['size'] !=="" ? intval($this->post['size']):10; $type = isset($this->post['type']) &&$this->post['type'] !=="" ? intval($this->post['type']):'0'; $where = [["type","=",$type]]; $name = isset($this->post['name']) &&$this->post['name'] !="" ? trim($this->post['name']):''; if($name!=''){ $where[]=["name|shortName","like","%{$name}%"]; } $plat_type = isset($this->post['plat_type']) &&$this->post['plat_type'] !="" ? trim($this->post['plat_type']):''; if($plat_type!=''){ $where[]=["plat_type","=",$plat_type]; } $count = Db::name("express")->where($where)->count(); $page>=ceil($count/$size) ? $page=ceil($count/$size) :""; $list= Db::name("express")->where($where)->field('id,type,comTypeName,name,plat_type,shortName,shortNameEn,shortNumber,canOrder') ->page($page,$size)->select(); return app_show(0,'获取成功',['list'=>$list,"count"=>$count]); } public function SetUse(){ $id = isset($this->post['id']) &&$this->post['id'] !="" ? intval($this->post['id']):''; if($id==''){ return error_show(1004,"参数id不能为空"); } $express = Db::name("express")->where(["id"=>$id])->find(); if(empty($express)){ return error_show(1004,"未找到数据"); } $express['canOrder'] = $express['canOrder']==0 ?1:0; $up = Db::name("express")->save($express); $orde = ["order_code"=>$id,"status"=>0,"action_remark"=>'',"action_type"=>"edit"]; ActionLog::logAdd($this->post['token'],$orde,'express',0,$orde); return $up?app_show(0,"更新成功"):error_show(1005,"更新失败"); } public function GetExpress(){ $type = isset($this->post['type']) &&$this->post['type'] !=="" ? intval($this->post['type']):''; $where[] = ['canOrder',"=",1]; if($type===0){ $where[]=["type","=",$type]; } $order_source = isset($this->post['order_source']) &&$this->post['order_source'] !=="" ? intval($this->post['order_source']):'1'; $plat_type=1; if( $order_source==5){ $plat_type=2; } $where[]=["plat_type","=",$plat_type]; $name = isset($this->post['name']) &&$this->post['name'] !="" ? trim($this->post['name']):''; if($name!=''){ $where[]=["name|shortName","like","%{$name}%"]; } $list= Db::name("express")->where($where)->field('id,type,comTypeName,name,shortName,shortNameEn,shortNumber,canOrder') ->select(); return app_show(0,'获取成功',$list); } }