From 89e67246d51b9d6b81765d97aab0904047368710 Mon Sep 17 00:00:00 2001 From: luofei <604446095@qq.com> Date: Thu, 10 Aug 2023 14:58:10 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=8E=B7=E5=8F=96=E9=85=8D?= =?UTF-8?q?=E9=80=81=E5=91=98=E4=BF=A1=E6=81=AF=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/controller/LogisticsController.php | 14 +++++++++++++- app/api/logic/LogisticsLogic.php | 18 ++++++++++++++++++ app/api/route/app.php | 4 +++- 3 files changed, 34 insertions(+), 2 deletions(-) diff --git a/app/api/controller/LogisticsController.php b/app/api/controller/LogisticsController.php index ae303a63..bdc832e5 100755 --- a/app/api/controller/LogisticsController.php +++ b/app/api/controller/LogisticsController.php @@ -24,7 +24,7 @@ use app\api\logic\LogisticsLogic; class LogisticsController extends BaseApiController { - public array $notNeedLogin = ['courierLogisticsList','courierLogisticsDetail','userLogisticsDetail','logisticsCreate','courierTakeGoods','courierCompleteDelivery','userConfirmReceipt','userCancelOrder']; + public array $notNeedLogin = ['courierLogisticsList','courierLogisticsDetail','userLogisticsDetail','logisticsCreate','courierTakeGoods','courierCompleteDelivery','userConfirmReceipt','userCancelOrder','courierData']; /* * 获取配送员物流信息列表 @@ -151,4 +151,16 @@ class LogisticsController extends BaseApiController return $this->data(LogisticsLogic::uDetail($params)); } + public function courierData():\think\response\Json + { + //获取参数 + $params = $this->request->get(['order_sn']); + //验证参数 + if(empty($params['order_sn'])) return $this->fail('参数错误'); + //获取数据 + $result = LogisticsLogic::courierInfo($params); + //返回数据 + return $result['code'] ==1 ? $this->success('获取成功',$result['data']) : $this->fail($result['msg']); + } + } \ No newline at end of file diff --git a/app/api/logic/LogisticsLogic.php b/app/api/logic/LogisticsLogic.php index e1f17cf2..dd4d14e8 100644 --- a/app/api/logic/LogisticsLogic.php +++ b/app/api/logic/LogisticsLogic.php @@ -347,4 +347,22 @@ class LogisticsLogic extends BaseLogic return ['code'=>0, 'msg'=>$e->getMessage()]; } } + + /* + * 配送员信息 + * @param $param + * @return array + */ + public static function courierInfo($params) { + //获取物流信息 + $logistics = Logistics::where('order_sn', $params['order_sn'])->find(); + if(!$logistics) return ['code'=>0, 'msg'=>'物流信息不存在']; + //获取配送员信息 + $courier = Courier::alias('u') + ->field('u.nickname,a.phone') + ->leftjoin('la_admin a', 'u.admin_id = a.id') + ->where('u.id', $logistics['courier_id'])->find()->toArray(); + //返回数据 + return ['code'=>1, 'msg'=>'success', 'data'=>$courier]; + } } \ No newline at end of file diff --git a/app/api/route/app.php b/app/api/route/app.php index 5e3fc482..96aec0f8 100755 --- a/app/api/route/app.php +++ b/app/api/route/app.php @@ -18,4 +18,6 @@ Route::rule('lstSet','Logistics/logisticsCreate','post'); Route::rule('takeGoods','Logistics/courierTakeGoods','post'); Route::rule('doneDelivery','Logistics/courierCompleteDelivery','post'); Route::rule('confirmReceipt','Logistics/userConfirmReceipt','post'); -Route::rule('cancelOrder','Logistics/userCancelOrder','post'); \ No newline at end of file +Route::rule('cancelOrder','Logistics/userCancelOrder','post'); + +Route::rule('courierData','Logistics/courierData','get'); \ No newline at end of file