配送员逻辑调整

This commit is contained in:
luofei 2023-08-09 14:15:24 +08:00
parent c8f1aab0f4
commit 25eb6ce7be
2 changed files with 7 additions and 9 deletions

View File

@ -119,14 +119,12 @@ class LogisticsLogic extends BaseLogic
->where('order_id', $params['order_id'])->where('order_sn', $params['order_sn'])->find();
if(empty($order['user_address_code'])) return ['code'=>1, 'msg'=>'用户地址信息错误'];
//匹配配送员
$arr = explode(',', $order['user_address_code']);
array_pop($arr);
$addr = implode(',', $arr);
$courier = Courier::alias('c')
->leftjoin('la_admin_role r', 'r.admin_id = c.id')
->where("CONCAT_WS(',',c.province,c.city,c.area,c.street,c.village) = '". $addr."'")
->where('r.role_id', 6)
->value('c.id');
$courier = Courier::alias('u')
->leftjoin('la_company c', 'c.id = u.company_id')
->where("CONCAT_WS(',',u.province,u.city,u.area,u.street,u.village,u.brigade) = '". $order['user_address_code']."'")
->where('u.is_contract', 1)
->where('u.is_captain',1)
->value('c.user_id');
//判断配送员是否存在
if(!$courier) return ['code'=>0, 'msg'=>'暂无配送员'];
//写入数据

View File

@ -28,7 +28,7 @@ class Courier extends BaseModel
{
protected $connection = 'mysql3';
protected $name = 'la_admin';
protected $name = 'la_user';