add 从新供销查配送员

This commit is contained in:
chenbo 2024-01-21 15:28:28 +08:00
parent 27661867ef
commit 8d056938d1
2 changed files with 11 additions and 7 deletions

View File

@ -165,9 +165,9 @@ class LogisticsController extends BaseApiController
$result = LogisticsLogic::getCoutier($param); $result = LogisticsLogic::getCoutier($param);
//返回数据 //返回数据
if($result){ if($result){
return $this->success('有配送员'); return $this->success('有配送员', $result);
}else{ }else{
return $this->fail('无配送员'); return $this->success('无配送员', []);
} }
} }

View File

@ -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(); $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'=>'无法确定所在小队']; 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'=>'配送员未匹配']; if(!$courier) return ['code'=>0, 'msg'=>'配送员未匹配'];
//获取下单用户信息 //获取下单用户信息
@ -400,12 +400,16 @@ class LogisticsLogic extends BaseLogic
public static function getCoutier($code):bool { 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; 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; if(!$courier) return false;
return true; return $courier;
} }
} }