diff --git a/app/common/service/JgPush.php b/app/common/service/JgPush.php index 3b487e1e..cbec4ce5 100644 --- a/app/common/service/JgPush.php +++ b/app/common/service/JgPush.php @@ -18,9 +18,10 @@ class JgPush { $this->client = new Client('b5f679f4357018605ea6fd2e', 'c4fb573758f8d7058d697c54'); $this->push = $this->client->push(); + $this->setPlatform(); } - public function init($type, $data) + public function send($type, $data) { switch ($type) { case 'ADMIN_PAY_SUCCESS_CODE': @@ -36,6 +37,7 @@ class JgPush $this->addRegistrationId($jgRegisterId); $this->androidNotification('您有新的订单,请注意查看。', ['extras' => ['route' => $route]]); $this->iosNotification('您有新的订单,请注意查看。', ['extras' => ['route' => $route]]); + $this->push->send(); } } break; @@ -49,14 +51,13 @@ class JgPush $this->addRegistrationId($jgRegisterId); $this->androidNotification('您的订单已发货,请注意查看。', ['extras' => ['route' => $route]]); $this->iosNotification('您的订单已发货,请注意查看。', ['extras' => ['route' => $route]]); + $this->push->send(); } } break; default: break; } - $this->setPlatform(); - return $this; } /** diff --git a/crmeb/jobs/SendSmsJob.php b/crmeb/jobs/SendSmsJob.php index b300df03..3b2c1009 100644 --- a/crmeb/jobs/SendSmsJob.php +++ b/crmeb/jobs/SendSmsJob.php @@ -30,10 +30,10 @@ class SendSmsJob implements JobInterface $status = app()->make(SystemNoticeConfigRepository::class)->getNoticeStatusByConstKey($data['tempId']); if ($status['notice_app'] == 1) { try { - /** @var JgPush $push */ - $push = app()->make(JgPush::class); + /** @var JgPush $client */ + $client = app()->make(JgPush::class); Log::info('app推送发送数据:' . var_export($data, 1)); - $push->init($data['tempId'], $data)->push->send(); + $client->send($data['tempId'], $data); } catch (\Exception $e) { Log::info('app推送消息发送失败' . var_export($data, 1) . $e->getMessage()); DingTalk::exception($e, 'app推送消息发送失败' . var_export($data, 1));