diff --git a/app/controller/api/dataview/Logistics.php b/app/controller/api/dataview/Logistics.php index dd74bb53..5435f8ef 100755 --- a/app/controller/api/dataview/Logistics.php +++ b/app/controller/api/dataview/Logistics.php @@ -188,4 +188,28 @@ class Logistics extends BaseController $latestTenOrder = Db::connect('logistics')->name('logistics')->field('receiver_address')->where(['status'=>1, 'courier_id' => $courierId])->order('id', 'desc')->limit(10)->select()->toArray(); return app('json')->success(compact('latestOrder', 'latestTenOrder')); } + + public function logisticsList() + { + $type = $this->request->param('type'); + $courierId = $this->request->param('courier_id'); + $list = []; + $count = 0; + if ($type == 1) { + // 待取货 + $list = Db::connect('logistics')->name('logistics')->where(['status'=>0, 'courier_id'=>$courierId])->select(); + $count = Db::connect('logistics')->name('logistics')->where(['status'=>0, 'courier_id'=>$courierId])->count(); + } + if ($type == 2) { + // 配送中 + $list = Db::connect('logistics')->name('logistics')->where(['status'=>1, 'courier_id'=>$courierId])->select(); + $count = Db::connect('logistics')->name('logistics')->where(['status'=>1, 'courier_id'=>$courierId])->count(); + } + if ($type == 3) { + // 已完成 + $list = Db::connect('logistics')->name('logistics')->where([['status', 'in', [2,3]], 'courier_id'=>$courierId])->select(); + $count = Db::connect('logistics')->name('logistics')->where([['status', 'in', [2,3]], 'courier_id'=>$courierId])->count(); + } + return app('json')->success(compact('count', 'list')); + } } \ No newline at end of file diff --git a/route/api.php b/route/api.php index 48c5d40e..79264e97 100644 --- a/route/api.php +++ b/route/api.php @@ -727,6 +727,7 @@ Route::group('api/', function () { Route::get('latest_logistics', 'Logistics/latestLogistics'); Route::get('logistics_count', 'Logistics/logisticsCount'); Route::get('logistics_map_count', 'Logistics/logisticsMapCount'); + Route::get('logistics_list', 'Logistics/logisticsList'); /**---------------------物流溯源监控大屏api---------------------- end **/