物流订单商品名称
This commit is contained in:
parent
bd39b6972f
commit
9aba394a36
@ -3,6 +3,7 @@
|
|||||||
namespace app\controller\api\dataview;
|
namespace app\controller\api\dataview;
|
||||||
|
|
||||||
use app\common\model\Company;
|
use app\common\model\Company;
|
||||||
|
use app\common\model\store\order\StoreOrderProduct;
|
||||||
use app\common\repositories\BaseRepository;
|
use app\common\repositories\BaseRepository;
|
||||||
use crmeb\basic\BaseController;
|
use crmeb\basic\BaseController;
|
||||||
use think\App;
|
use think\App;
|
||||||
@ -126,6 +127,9 @@ class Logistics extends BaseController
|
|||||||
->where(['area'=> $this->areaCode, 'company_type'=>18])
|
->where(['area'=> $this->areaCode, 'company_type'=>18])
|
||||||
->column('id');
|
->column('id');
|
||||||
|
|
||||||
|
if (empty($serviceGroupCompanyIds)) {
|
||||||
|
return app('json')->success($list);
|
||||||
|
}
|
||||||
$userIdList = Db::connect('work_task')->name('user')
|
$userIdList = Db::connect('work_task')->name('user')
|
||||||
->whereIn('company_id', $serviceGroupCompanyIds)
|
->whereIn('company_id', $serviceGroupCompanyIds)
|
||||||
->where(['group_id'=>5])
|
->where(['group_id'=>5])
|
||||||
@ -139,10 +143,15 @@ class Logistics extends BaseController
|
|||||||
->order('order_count DESC')
|
->order('order_count DESC')
|
||||||
->select();
|
->select();
|
||||||
|
|
||||||
|
|
||||||
foreach ($topCourierList as $topCourier) {
|
foreach ($topCourierList as $topCourier) {
|
||||||
// 三轮车车牌号 根据配送员id反查公司id,公司id反查车牌号
|
// 三轮车车牌号 根据配送员id反查公司id,公司id反查车牌号
|
||||||
$courier = Db::connect('work_task')->name('user')->where(['id'=>$topCourier['courier_id']])->find();
|
$courier = Db::connect('work_task')->name('user')->where(['id'=>$topCourier['courier_id']])->find();
|
||||||
|
|
||||||
$vehicleRent = Db::connect('work_task')->name('vehicle_rent')->where(['rent_company_id'=>$courier['company_id']])->find();
|
$vehicleRent = Db::connect('work_task')->name('vehicle_rent')->where(['rent_company_id'=>$courier['company_id']])->find();
|
||||||
|
if (empty($vehicleRent)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
$topCourier['id'] = $vehicleRent['car_id'];
|
$topCourier['id'] = $vehicleRent['car_id'];
|
||||||
$topCourier['license'] = $vehicleRent['car_license'];
|
$topCourier['license'] = $vehicleRent['car_license'];
|
||||||
$topCourier['area_code'] = $courier['area'];
|
$topCourier['area_code'] = $courier['area'];
|
||||||
@ -305,6 +314,10 @@ class Logistics extends BaseController
|
|||||||
$query->whereBetween('ps_time', [$startTime, $endTime]);
|
$query->whereBetween('ps_time', [$startTime, $endTime]);
|
||||||
})->count();
|
})->count();
|
||||||
}
|
}
|
||||||
|
foreach ($list as &$item) {
|
||||||
|
$item['product_name'] = StoreOrderProduct::alias('o')->join('store_product p', 'o.product_id=p.product_id')->where('o.order_id', $item['order_id'])->value('p.store_name');
|
||||||
|
}
|
||||||
|
unset($item);
|
||||||
return app('json')->success(compact('count', 'list'));
|
return app('json')->success(compact('count', 'list'));
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user