|
|
@@ -15,7 +15,9 @@ class OrderPackageReceivedSyncService
|
|
|
protected $logisticZopService;
|
|
|
|
|
|
/**
|
|
|
- *同步快递信息
|
|
|
+ * 同步快递信息
|
|
|
+ * 1 如果当前时间大于初始化时间 每日执行一次,更新order_packages中创建时间大于初始化时间,没有异常,用户未收货的全部订单的快递路由状态
|
|
|
+ * 2 如果当前时间小于等于初始化时间,执行初始化脚本,将数据库中全部小于等于初始化时间的数据更新
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public function syncLogisticRoute()
|
|
|
@@ -23,6 +25,17 @@ class OrderPackageReceivedSyncService
|
|
|
$this->update($this->getLogisticRoutes($this->getLogisticNumbers()));
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 根据传递的承运商与快递单号更新快递信息,延迟一小时执行
|
|
|
+ * @param array $logisticNumbers 快递单号
|
|
|
+ * example: ['SF' => ['SF1038651915891', 'SF1038651413847', 'SF1038611050071'],'ZT'=>['75424148714142','548464120822', '75424147834290']....]
|
|
|
+ * @throws Exception 快递接口调用或者返回的信息有误,无法更新指定的快递路由信息
|
|
|
+ */
|
|
|
+ public function syncLogisticRouteApi(array $logisticNumbers)
|
|
|
+ {
|
|
|
+ $this->update($this->getLogisticRoutes($logisticNumbers));
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 获取快件揽收信息
|
|
|
* @param array $request [
|
|
|
@@ -67,7 +80,7 @@ class OrderPackageReceivedSyncService
|
|
|
public function update(array $orderPackages)
|
|
|
{
|
|
|
foreach ($orderPackages as $data) {
|
|
|
- $orderPackage = OrderPackage::query()->where('logistic_number',$data['logistic_number'])->first();
|
|
|
+ $orderPackage = OrderPackage::query()->where('logistic_number', $data['logistic_number'])->first();
|
|
|
if (isset($data['status'])) $orderPackage->status = $data['status'];
|
|
|
if (isset($data['received_at'])) $orderPackage->received_at = $data['received_at'];
|
|
|
if (isset($data['exception'])) $orderPackage->exception = $data['exception'];
|