UserCertifyFailNotification.php 1.44 KB
<?php

namespace App\Notifications;

use App\Models\User;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Notification;

class UserCertifyFailNotification extends Notification  implements ShouldQueue
{
    use Queueable;

    /**
     * Create a new notification instance.
     *
     * @return void
     */
    public function __construct()
    {
        //
    }

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

    /**
     * @param \App\Models\User $notifiable
     * @return array
     */
    public function toJPush(User $notifiable): array
    {
        return [
            'user'    => $notifiable->getKey(),
            'title'   => '认证申请未通过',
            'content' => '点击查看详情',
            'data'    => ['type' => 'OpenApp', 'value' => '']
        ];
    }

    /**
     * @param \App\Models\User $notifiable
     * @return array
     */
    public function toSms(User $notifiable): array
    {
        return [
            'phone' => $notifiable->getPhoneNotificationKey(),
            'data'  => [
                'template' => 'SMS_254165982',
                'content'  => '您的账号审核未通过,请前往海星试唱APP/小程序查看详情,修改审核信息后重新提交。'
            ]
        ];
    }
}