|
|
@@ -89,7 +89,7 @@ class OrderPackageReceivedSyncService
|
|
|
->select(['logistic_number', 'order_id'])
|
|
|
->whereIn('order_id',function ($query){
|
|
|
$query->from('orders')->selectRaw('id')->whereIn('logistic_id',function ($builder){
|
|
|
- $builder->from('logistics')->selectRaw('id')->where('type','!=','物流')->whereNotIn('belong_company',['顺丰','中通','韵达','圆通']);
|
|
|
+ $builder->from('logistics')->selectRaw('id')->where('type','!=','物流')->whereNotIn('belong_company',['顺丰','中通','韵达','圆通','京东']);
|
|
|
});
|
|
|
});
|
|
|
$query = $query->where('sent_at', '>=', now()->subDays(20))
|
|
|
@@ -99,6 +99,26 @@ class OrderPackageReceivedSyncService
|
|
|
if ($orderPackage && $orderPackage->logistic_number)LogisticAliJiSuSync::dispatch($orderPackage->logistic_number);
|
|
|
}
|
|
|
});
|
|
|
+ $this->syncLogisticRouteJD();
|
|
|
+ }
|
|
|
+ public function syncLogisticRouteJD(){
|
|
|
+ ini_set('max_execution_time', 60);
|
|
|
+ $query = OrderPackage::query()
|
|
|
+ ->select(['logistic_number', 'order_id'])
|
|
|
+ ->whereIn('order_id',function ($query){
|
|
|
+ $query->from('orders')->selectRaw('id')->whereIn('logistic_id',function ($builder){
|
|
|
+ $builder->from('logistics')->selectRaw('id')->where('type','!=','物流')->where('belong_company','京东');
|
|
|
+ });
|
|
|
+ });
|
|
|
+ $query = $query->where('created_at', '>=', now()->subDays(20))
|
|
|
+ ->whereNull('received_at');
|
|
|
+ $query->chunk(200, function ($orderPackages) {
|
|
|
+ foreach ($orderPackages as $orderPackage){
|
|
|
+ if ($orderPackage
|
|
|
+ && $orderPackage->logistic_number
|
|
|
+ && strpos($orderPackage->logistic_number,'JD')!==false)LogisticAliJiSuSync::dispatch($orderPackage->logistic_number);
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
/**
|
|
|
* 根据传递的承运商与快递单号更新快递信息
|