request->get(['user_id','user_type','status','page_size','page_num','keywords']); //验证参数 if(empty($params['user_id'])) return $this->fail('参数错误'); if(!isset($params['user_type'])) return $this->fail('参数错误'); if(empty($params['keywords'])) $params['keywords'] = ''; //返回数据 return $this->data(LogisticsLogic::list($params)); } /* * 获取物流信息详情 * @method get * @param int $logistics_id 物流id * @return \think\response\Json */ public function courierLogisticsDetail(): \think\response\Json { //获取参数 $logistics_id = $this->request->get('logistics_id'); //验证参数 if(empty($logistics_id)) return $this->fail('参数错误'); //返回数据 return $this->data(LogisticsLogic::cDetail($logistics_id)); } /* * 生成物流信息 * @method post * @param int $order_id 订单id * @param string $order_sn 订单编号 * @return \think\response\Json */ public function logisticsCreate(): \think\response\Json { //获取参数 $params = $this->request->post(['order_id','order_sn']); //验证参数 if(empty($params['order_id']) || empty($params['order_sn'])) return $this->fail('参数错误'); //生成数据 $result = LogisticsLogic::create($params); //返回数据 return $result['code'] ==1 ? $this->success('生成成功',$result['data']) : $this->fail($result['msg']); } /* * 配送员提取商品 * @method post * @param int $logistics_id 物流id * @return \think\response\Json */ public function courierTakeGoods(): \think\response\Json { //获取参数 $params = $this->request->post(['logistics_id','order_id','order_sn']); //验证参数 if(empty($params['logistics_id']) || empty($params['order_id']) || empty($params['order_sn'])) return $this->fail('参数错误'); //提取商品 $result = LogisticsLogic::takeGoods($params); //返回数据 return $result['code'] ==1 ? $this->success('提取成功') : $this->fail($result['msg']); } /* * 配送员完成配送 * @method post * @param int $logistics_id 物流id * @return \think\response\Json */ public function courierCompleteDelivery(): \think\response\Json { //获取参数 $params = $this->request->post(['logistics_id','take_code']); //验证参数 if(empty($params['logistics_id']) || empty($params['take_code'])) return $this->fail('参数错误'); //完成配送 $result = LogisticsLogic::doneDelivery($params); //返回数据 return $result['code'] ==1 ? $this->success('配送完成') : $this->fail($result['msg']); } /* * 用户取消订单 * @method post * @param int $logistics_id 物流id * @return \think\response\Json */ public function userCancelOrder(): \think\response\Json { //获取参数 $params = $this->request->post(['order_id','order_sn']); //验证参数 if(empty($params['order_id']) || empty($params['order_sn'])) return $this->fail('参数错误'); //完成配送 $result = LogisticsLogic::cancel($params); //返回数据 return $result['code'] ==1 ? $this->success('取消成功') : $this->fail($result['msg']); } /* * 商超端物流详情 * @method post * @param int $logistics_id 物流id * @return \think\response\Json */ public function userLogisticsDetail(): \think\response\Json { //获取参数 $params = $this->request->get(['order_id','order_sn']); //验证参数 if(empty($params['order_id']) || empty($params['order_sn'])) return $this->fail('参数错误'); //返回数据 return $this->data(LogisticsLogic::uDetail($params)); } //获取配送员 public function hasCourier(): \think\response\Json { //获取参数 $param = $this->request->get('user_address_code'); if(empty($param)) { return $this->fail('参数错误'); } $result = LogisticsLogic::getCoutier($param); //返回数据 if($result){ return $this->success('有配送员'); }else{ return $this->fail('无配送员'); } } }