调试极光推送

This commit is contained in:
luofei 2023-07-01 16:14:09 +08:00
parent a54e837d74
commit 315c87c754
2 changed files with 7 additions and 6 deletions

View File

@ -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;
}
/**

View File

@ -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));