Merge branch 'dev' into preview

This commit is contained in:
chenbo 2024-01-26 10:43:56 +08:00
commit 47512bc834

View File

@ -185,11 +185,17 @@ class LogisticsLogic extends BaseLogic
if(empty($order['user_address_code'])) return ['code'=>0, 'msg'=>'用户地址信息错误'];
//查找商家信息
$shop = Merchant::field('mer_id,mer_name,real_name,mer_phone,mer_address,long,lat')->where('mer_id',$order['mer_id'])->find();
$userAddressCode = explode(',', $order['user_address_code']);
//获取队长用户信息
$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'=>'无法确定所在小队'];
$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 = Courier::field('nickname as company_name,id as user_id,nickname as master_name,mobile as master_phone')->where('group_id',20)->find();
$courier = Courier::field('nickname as company_name,id as user_id,nickname as master_name,mobile as master_phone')
->where(['province' => $userAddressCode[0], 'city' => $userAddressCode[1], 'area' => $userAddressCode[2], 'street' => $userAddressCode[3], 'village' => $userAddressCode[4]])
->where('group_id',20)->find();
//判断配送员是否存在
if(!$courier) return ['code'=>0, 'msg'=>'配送员未匹配'];
//获取下单用户信息
@ -204,9 +210,9 @@ class LogisticsLogic extends BaseLogic
'user_id' => $orderUser['uid'],
'user_name' => $orderUser['nickname'],
'user_phone' => $orderUser['phone'],
'captain_id' => $captain['id'],
'captain_name' => $captain['nickname'],
'captain_phone' => $captain['mobile'],
'captain_id' => $captain['id']??0,
'captain_name' => $captain['nickname']??'',
'captain_phone' => $captain['mobile']??'',
'courier_id' => $courier['user_id'],
'courier_name' => $courier['master_name'],
'courier_phone' => $courier['master_phone'],
@ -409,7 +415,7 @@ class LogisticsLogic extends BaseLogic
// $courier = Company::field('company_name,user_id,master_name,master_phone')->where('id',$captain['company_id'])->find();
if(!$courier) return false;
return $courier;
return $courier->toArray();
}
}