请问在通知系统里使用外部 API 比如极光推送 当外部 API 报异常的时候 代码不会抛出异常也不会进错误队列

请问在通知系统里使用外部api比如极光推送 当外部api报异常的时候 代码不会抛出异常也不会进错误队列

<?php

namespace App\Notifications;

use App\Models\WorkOrders\TransferOrder;
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Notification;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\MailMessage;
use Medz\Laravel\Notifications\JPush\Message as JPushMessage;

class TransferOrderCreatedNotification extends Notification implements ShouldQueue
{
    use Queueable;
    private $title;
    private $alert;
    private $transferOrder;
    /**
     * Create a new notification instance.
     *
     * @return void
     */
    public function __construct($title='',$alert='',$transferOrder=null)
    {
        $this->title=$title;
        $this->alert=$alert;
        $this->transferOrder=$transferOrder;
    }

    /**
     * Get the notification's delivery channels.
     *
     * @param  mixed  $notifiable
     * @return array
     */
    public function via($notifiable)
    {
        return ['jpush'];
    }

    /**
     * Get the mail representation of the notification.
     *
     * @param  mixed  $notifiable
     * @return \Illuminate\Notifications\Messages\MailMessage
     */
    public function toMail($notifiable)
    {
        return (new MailMessage)
            ->line('The introduction to the notification.')
            ->action('Notification Action', url('/'))
            ->line('Thank you for using our application!');
    }

    /**
     * Get the array representation of the notification.
     *
     * @param  mixed  $notifiable
     * @return array
     */
    public function toArray($notifiable)
    {
        return [
            //
        ];
    }

    public function toJpush($notifiable)
    {
        $message = new JPushMessage();
        // TODO

            //====== 把所有的配置都进行配置 ===

            $aaa='
            Alert.Alert.Alert.Alert.Alert.Alert.Alert.Alert.Alert.Alert.Alert.........';// 比如这里是超长的字符串 应该会抛出异常 但是没有
            $message->setAlert($aaa); // 简单地给所有平台推送相同的 alert 消息
//
//
//            // 自定义消息
            $message->setMessage('Message', [
                //'title' => 'ttt', // 通知标题,会填充到 toast 类型 text1 字段上
                ///'_open_page' => '123', //点击打开的页面名称
                'extras' => [22], // 自定义的数据内容
            ]);
//
//            // iOS 通知
//            $message->setNotification(JPushMessage::IOS, 'Alert 内容', [
//                'alert' => '', // 覆盖第二个参数的 Alert 内,推荐不传,
//                'sound' => '', // 表示通知提示声音,默认填充为空字符串
//                'badge' => '', // 表示应用角标,把角标数字改为指定的数字;为 0 表示清除,支持 '+1','-1' 这样的字符串,表示在原有的 badge 基础上进行增减,默认填充为 '+1'
//                /// ...
//            ]);
//
//            // 更多通知请参考 https://docs.jiguang.cn/jpush/server/push/rest_api_v3_push/#notification 官方文档
//            // 使用 `setNotification` 方法第一个常量有三个: IOS/ANDROID/WP
//
//            // 可选参数
//            $message->setOptions([]); // 参考 https://docs.jiguang.cn/jpush/server/push/rest_api_v3_push/#options

        \Illuminate\Support\Facades\Notification::sendNow(User::find(1),$n);

        return $message;
    }
}
《L05 电商实战》
从零开发一个电商项目,功能包括电商后台、商品 & SKU 管理、购物车、订单管理、支付宝支付、微信支付、订单退款流程、优惠券等
《L02 从零构建论坛系统》
以构建论坛项目 LaraBBS 为线索,展开对 Laravel 框架的全面学习。应用程序架构思路贴近 Laravel 框架的设计哲学。
讨论数量: 0
(= ̄ω ̄=)··· 暂无内容!

讨论应以学习和精进为目的。请勿发布不友善或者负能量的内容,与人为善,比聪明更重要!