From c744d8f8e9fac0a4df4b1dc4d9f76c7e39307adf Mon Sep 17 00:00:00 2001 From: luofei <604446095@qq.com> Date: Fri, 11 Aug 2023 15:26:47 +0800 Subject: [PATCH] patch --- app/api/logic/LogisticsLogic.php | 13 ++++++----- app/common/model/logistics/User.php | 35 +++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+), 5 deletions(-) create mode 100644 app/common/model/logistics/User.php diff --git a/app/api/logic/LogisticsLogic.php b/app/api/logic/LogisticsLogic.php index c5e7cff6..2f9add27 100644 --- a/app/api/logic/LogisticsLogic.php +++ b/app/api/logic/LogisticsLogic.php @@ -20,6 +20,7 @@ use app\common\model\logistics\Logistics; use app\common\model\logistics\Order; use app\common\model\logistics\Product; use app\common\model\logistics\LogisticsRecord; +use app\common\model\logistics\User; /** @@ -164,7 +165,7 @@ class LogisticsLogic extends BaseLogic //查找订单信息 $order = Order::alias('s') ->leftjoin('eb_merchant m', 'm.mer_id = s.mer_id') - ->field('s.real_name, s.user_phone,s.uid, s.user_address,s.user_address_code,m.mer_id,m.mer_name,m.mer_phone,m.mer_address,m.long,m.lat') + ->field('s.real_name, s.user_phone,s.uid, s.user_address,s.user_address_code,s.logistics_code,m.mer_id,m.mer_name,m.mer_phone,m.mer_address,m.long,m.lat') ->where('order_id', $params['order_id'])->where('order_sn', $params['order_sn'])->find(); if(empty($order['user_address_code'])) return ['code'=>1, 'msg'=>'用户地址信息错误']; //匹配配送员 @@ -175,15 +176,16 @@ class LogisticsLogic extends BaseLogic ->where('u.is_captain',1) ->value('c.user_id'); //判断配送员是否存在 - if(!$courier) return ['code'=>0, 'msg'=>'暂无配送员']; + $courier = $courier ?? 0; //获取配送员信息 $courierInfo = Courier::alias('u') ->field('u.id,u.nickname,a.phone') ->leftjoin('la_admin a', 'u.admin_id = a.id') ->where('u.id', $courier)->find(); + if(!$courierInfo) return ['code'=>0, 'msg'=>'配送员未匹配']; //获取下单用户信息 - $orderUser = Courier::field('nickname,mobile')->where('id', $order['uid'])->find(); + $orderUser = User::field('nickname,phone')->where('uid', $order['uid'])->find(); //写入数据 Logistics::startTrans(); try { @@ -201,6 +203,7 @@ class LogisticsLogic extends BaseLogic 'user_name' => $order['real_name'], 'user_phone' => $order['user_phone'], 'user_address' => $order['user_address'], + 'user_take_code' => '', 'status' => 0, 'create_time' => time(), 'update_time' => time(), @@ -209,12 +212,12 @@ class LogisticsLogic extends BaseLogic 'lst_id' => $lst->id, 'type' => 1, 'user_name' => $orderUser['nickname'], - 'user_phone' => $orderUser['mobile'], + 'user_phone' => $orderUser['phone'], 'content' => '用户提交订单', 'create_time' => time(), ]); Logistics::commit(); - return ['code'=>1, 'msg'=>'操作成功','data'=>$courierInfo]; + return ['code'=>1, 'msg'=>'操作成功','data'=>$courierInfo->toArray()]; } catch (\Exception $e) { Logistics::rollback(); return ['code'=>0, 'msg'=>$e->getMessage()]; diff --git a/app/common/model/logistics/User.php b/app/common/model/logistics/User.php new file mode 100644 index 00000000..db97fb99 --- /dev/null +++ b/app/common/model/logistics/User.php @@ -0,0 +1,35 @@ +