From 315c87c754e6ac63cc5e596dbd3f4aef54034c3e Mon Sep 17 00:00:00 2001 From: luofei <604446095@qq.com> Date: Sat, 1 Jul 2023 16:14:09 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E8=AF=95=E6=9E=81=E5=85=89=E6=8E=A8?= =?UTF-8?q?=E9=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common/service/JgPush.php | 7 ++++--- crmeb/jobs/SendSmsJob.php | 6 +++--- 2 files changed, 7 insertions(+), 6 deletions(-) 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));