diff --git a/crmeb/jobs/SendGoodsCodeJob.php b/crmeb/jobs/SendGoodsCodeJob.php index 269b37a8..1f7686fc 100644 --- a/crmeb/jobs/SendGoodsCodeJob.php +++ b/crmeb/jobs/SendGoodsCodeJob.php @@ -13,7 +13,7 @@ namespace crmeb\jobs; - +use app\common\repositories\store\order\StoreOrderRepository; use crmeb\interfaces\JobInterface; use think\facade\Log; use think\facade\Db; @@ -27,16 +27,20 @@ class SendGoodsCodeJob implements JobInterface public function fire($job, $data) { $this->event = $data; + Log::info("sendGoodsCodeJob" . json_encode($this->event)); Log::info("sendGoodsCodeJob ============= handle监听order_id " . $this->event['order_id']); - if ($this->event['activity_type'] == 0) { - //发起物流信息返回快递员手机 - $logisticsPhone = $this->sendLogistics($this->event['order_id'], $this->event['order_sn']); - //生成用户的收货码 - $this->generateLogisticsCode($this->event['uid'], $this->event['order_id'], $this->event['order_sn'], $logisticsPhone); - //记录订单收货地址记录 - $this->recordOrderAddr($this->event); + try { + if ($this->event['activity_type'] == 0) { + //发起物流信息返回快递员手机 + $logisticsPhone = $this->sendLogistics($this->event['order_id'], $this->event['order_sn']); + //生成用户的收货码 + $this->generateLogisticsCode($this->event['uid'], $this->event['order_id'], $this->event['order_sn'], $logisticsPhone); + //记录订单收货地址记录 + $this->recordOrderAddr($this->event); + } + } catch (\Exception $e) { + Log::info('sendGoodsCodeJob 异常:' . $e->getMessage()); } - $job->delete(); } @@ -54,16 +58,16 @@ class SendGoodsCodeJob implements JobInterface 'street_code' => $addressInfo[3] ?? '', 'village_code' => $addressInfo[4] ?? '', 'brigade_id' => $addressInfo[5] ?? 0, + 'product_id' => 0, + 'product_price' => 0, + 'total_price' => $order['pay_price'] ?? 0, + 'product_num' => $order['total_num'] ?? 0, 'status' => 1, 'create_time' => date('Y-m-d H:i:s') ]; //商品信息 $productInfo = Db::name('store_order_product')->where('order_id', $order['order_id'] ?? 0)->find(); if ($productInfo) { - $productOrder['product_id'] = $productInfo['product_id'] ?? 0; - $productOrder['product_price'] = $productInfo['product_price'] ?? 0; - $productOrder['total_price'] = $productInfo['total_price'] ?? 0; - $productOrder['product_num'] = $productInfo['product_num'] ?? 0; } //商户信息 $merchantInfo = Db::name('merchant')->where('mer_id', $order['mer_id'] ?? 0)->find();