diff --git a/app/api/controller/LogisticsController.php b/app/api/controller/LogisticsController.php index 131bee4f..b08bf302 100755 --- a/app/api/controller/LogisticsController.php +++ b/app/api/controller/LogisticsController.php @@ -165,9 +165,9 @@ class LogisticsController extends BaseApiController $result = LogisticsLogic::getCoutier($param); //返回数据 if($result){ - return $this->success('有配送员'); + return $this->success('有配送员', $result); }else{ - return $this->fail('无配送员'); + return $this->success('无配送员', []); } } diff --git a/app/api/logic/LogisticsLogic.php b/app/api/logic/LogisticsLogic.php index 9df456ab..96c513ed 100644 --- a/app/api/logic/LogisticsLogic.php +++ b/app/api/logic/LogisticsLogic.php @@ -186,10 +186,10 @@ class LogisticsLogic extends BaseLogic //查找商家信息 $shop = Merchant::field('mer_id,mer_name,real_name,mer_phone,mer_address,long,lat')->where('mer_id',$order['mer_id'])->find(); //获取队长用户信息 - $captain = Courier::field('id,company_id,nickname,mobile')->where("CONCAT_WS(',',province,city,area,street,village,brigade) = '". $order['user_address_code']."'")->where('is_captain',1)->find(); + $captain = Courier::field('id,company_id,nickname,mobile')->where("CONCAT_WS(',',province,city,area,street,village,brigade) = '". $order['user_address_code']."'")->whereIn('group_id',[2, 18])->find(); if(!$captain) return ['code'=>0, 'msg'=>'无法确定所在小队']; //获取配送员信息 - $courier = Company::field('company_name,user_id,master_name,master_phone')->where('id',$captain['company_id'])->find(); + $courier = Courier::field('id as user_id,nickname as master_name,mobile as master_phone')->where('group_id',20)->find(); //判断配送员是否存在 if(!$courier) return ['code'=>0, 'msg'=>'配送员未匹配']; //获取下单用户信息 @@ -400,12 +400,16 @@ class LogisticsLogic extends BaseLogic public static function getCoutier($code):bool { //获取队长用户信息 - $captain = Courier::field('id,company_id,nickname,mobile')->where("CONCAT_WS(',',province,city,area,street,village,brigade) = '". $code ."'")->where('is_captain',1)->find(); + $captain = Courier::field('id,company_id,nickname,mobile')->where("CONCAT_WS(',',province,city,area,street,village,brigade) = '". $code."'")->whereIn('group_id',[2, 18])->find(); + +// $captain = Courier::field('id,company_id,nickname,mobile')->where("CONCAT_WS(',',province,city,area,street,village,brigade) = '". $code ."'")->where('is_captain',1)->find(); if(!$captain) return false; //获取配送员信息 - $courier = Company::field('company_name,user_id,master_name,master_phone')->where('id',$captain['company_id'])->find(); + $courier = Courier::field('id as user_id,nickname as master_name,mobile as master_phone')->where('group_id',20)->find(); + +// $courier = Company::field('company_name,user_id,master_name,master_phone')->where('id',$captain['company_id'])->find(); if(!$courier) return false; - return true; + return $courier; } } \ No newline at end of file