增加获取配送员信息接口

This commit is contained in:
luofei 2023-08-10 14:58:10 +08:00
parent 7b4c13f954
commit 89e67246d5
3 changed files with 34 additions and 2 deletions

View File

@ -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']);
}
}

View File

@ -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];
}
}

View File

@ -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');
Route::rule('cancelOrder','Logistics/userCancelOrder','post');
Route::rule('courierData','Logistics/courierData','get');