From 25eb6ce7be5b55cd8359030eb3879b5bb224d750 Mon Sep 17 00:00:00 2001 From: luofei <604446095@qq.com> Date: Wed, 9 Aug 2023 14:15:24 +0800 Subject: [PATCH] =?UTF-8?q?=E9=85=8D=E9=80=81=E5=91=98=E9=80=BB=E8=BE=91?= =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/logic/LogisticsLogic.php | 14 ++++++-------- app/common/model/logistics/Courier.php | 2 +- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/app/api/logic/LogisticsLogic.php b/app/api/logic/LogisticsLogic.php index 16ba9adf..bb506aba 100644 --- a/app/api/logic/LogisticsLogic.php +++ b/app/api/logic/LogisticsLogic.php @@ -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'=>'暂无配送员']; //写入数据 diff --git a/app/common/model/logistics/Courier.php b/app/common/model/logistics/Courier.php index e4026fec..1ea28e1b 100644 --- a/app/common/model/logistics/Courier.php +++ b/app/common/model/logistics/Courier.php @@ -28,7 +28,7 @@ class Courier extends BaseModel { protected $connection = 'mysql3'; - protected $name = 'la_admin'; + protected $name = 'la_user';