物流订单商品名称

This commit is contained in:
chenbo 2024-01-02 15:54:43 +08:00
parent bd39b6972f
commit 9aba394a36

View File

@ -3,6 +3,7 @@
namespace app\controller\api\dataview;
use app\common\model\Company;
use app\common\model\store\order\StoreOrderProduct;
use app\common\repositories\BaseRepository;
use crmeb\basic\BaseController;
use think\App;
@ -126,6 +127,9 @@ class Logistics extends BaseController
->where(['area'=> $this->areaCode, 'company_type'=>18])
->column('id');
if (empty($serviceGroupCompanyIds)) {
return app('json')->success($list);
}
$userIdList = Db::connect('work_task')->name('user')
->whereIn('company_id', $serviceGroupCompanyIds)
->where(['group_id'=>5])
@ -139,10 +143,15 @@ class Logistics extends BaseController
->order('order_count DESC')
->select();
foreach ($topCourierList as $topCourier) {
// 三轮车车牌号 根据配送员id反查公司id公司id反查车牌号
$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();
if (empty($vehicleRent)) {
continue;
}
$topCourier['id'] = $vehicleRent['car_id'];
$topCourier['license'] = $vehicleRent['car_license'];
$topCourier['area_code'] = $courier['area'];
@ -305,6 +314,10 @@ class Logistics extends BaseController
$query->whereBetween('ps_time', [$startTime, $endTime]);
})->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'));
}
}