|
|
@@ -71,20 +71,19 @@ class OrderPackageReceivedSyncService
|
|
|
}
|
|
|
}
|
|
|
//更新圆通
|
|
|
- if (array_key_exists('YTO', $logisticNumbers)) {
|
|
|
- $YTOLogisticNumbers = $logisticNumbers['YTO'];
|
|
|
- LogService::log(OrderPackageReceivedSyncService::class, "同步快递信息定时方法-YTO", '');
|
|
|
- foreach ($YTOLogisticNumbers as $logistic_number) {
|
|
|
- LogisticYTOSync::dispatch($logistic_number);
|
|
|
- }
|
|
|
- }
|
|
|
+// if (array_key_exists('YTO', $logisticNumbers)) {
|
|
|
+// $YTOLogisticNumbers = $logisticNumbers['YTO'];
|
|
|
+// LogService::log(OrderPackageReceivedSyncService::class, "同步快递信息定时方法-YTO", $YTOLogisticNumbers);
|
|
|
+// foreach ($YTOLogisticNumbers as $logistic_number) {
|
|
|
+// LogisticYTOSync::dispatch($logistic_number);
|
|
|
+// }
|
|
|
+// }
|
|
|
});
|
|
|
}
|
|
|
|
|
|
public function syncLogisticRouteByAliJiSu()
|
|
|
{
|
|
|
ini_set('max_execution_time', 2 * 60 * 60);
|
|
|
- LogService::log(OrderPackageReceivedSyncService::class, "阿里同步快递信息定时方法", '');
|
|
|
$query = OrderPackage::query()
|
|
|
->select(['logistic_number', 'order_id'])
|
|
|
->whereIn('order_id',function ($query){
|
|
|
@@ -95,6 +94,7 @@ class OrderPackageReceivedSyncService
|
|
|
$query = $query->where('sent_at', '>=', now()->subDays(20))
|
|
|
->whereNull('received_at');
|
|
|
$query->chunk(200, function ($orderPackages) {
|
|
|
+ LogService::log(OrderPackageReceivedSyncService::class, "同步快递信息定时方法-阿里公用接口", json_encode($orderPackages));
|
|
|
foreach ($orderPackages as $orderPackage){
|
|
|
if ($orderPackage && $orderPackage->logistic_number)LogisticAliJiSuSync::dispatch($orderPackage->logistic_number);
|
|
|
}
|
|
|
@@ -113,11 +113,30 @@ class OrderPackageReceivedSyncService
|
|
|
$query = $query->where('created_at', '>=', now()->subDays(20))
|
|
|
->whereNull('received_at')->where('logistic_number','like','JD%');
|
|
|
$query->chunk(200, function ($orderPackages) {
|
|
|
+ LogService::log(OrderPackageReceivedSyncService::class, "同步快递信息定时方法-JD", json_encode($orderPackages));
|
|
|
foreach ($orderPackages as $orderPackage){
|
|
|
if ($orderPackage && $orderPackage->logistic_number)LogisticAliJiSuSync::dispatch($orderPackage->logistic_number);
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
+ public function syncLogisticRouteYTO(){
|
|
|
+ ini_set('max_execution_time', 120);
|
|
|
+ $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('sent_at', '>=', now()->subDays(20))
|
|
|
+ ->whereNull('received_at');
|
|
|
+ $query->chunk(1000, function ($orderPackages) {
|
|
|
+ LogService::log(OrderPackageReceivedSyncService::class, "同步快递信息定时方法-YTO", json_encode($orderPackages));
|
|
|
+ foreach ($orderPackages as $orderPackage){
|
|
|
+ if ($orderPackage && $orderPackage->logistic_number)LogisticYTOSync::dispatch($orderPackage->logistic_number);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
/**
|
|
|
* 根据传递的承运商与快递单号更新快递信息
|
|
|
* @param array $logisticNumbers 快递单号
|