ActivitySingerSubmitWorkPassNotification.php
1.98 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
<?php
namespace App\Notifications;
use App\Models\User;
use App\Models\Views\ActivityWork;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Notification;
class ActivitySingerSubmitWorkPassNotification extends Notification implements ShouldQueue
{
use Queueable;
public ActivityWork $work;
/**
* Create a new notification instance.
*
* @return void
*/
public function __construct(ActivityWork $work)
{
$this->work = $work;
}
/**
* Get the notification's delivery channels.
*
* @return array
*/
public function via(): array
{
return ['wechat', 'jPush'];
}
/**
* @param \App\Models\User $notifiable
* @return array
*/
public function toJPush(User $notifiable): array
{
return [
'user' => $notifiable->getKey(),
'title' => '您的歌手成功达成合作',
'content' => sprintf("您的歌手%s参与试唱活动《%s》达成合作", $this->work->getAttribute('user_nick_name'), $this->work->getAttribute('activity_name')),
'data' => ['type' => 'ToComplete', 'value' => $this->work->getAttribute('user_id')]
];
}
/**
* @param \App\Models\User $notifiable
* @return array
*/
public function toWechat(User $notifiable): array
{
return [
'openId' => $notifiable->getWechatNotificationKey(),
'template' => '-qM3dii-zb8nnvPunYDFyPmNptnKzdkgiWRH4-nK8vA',
'page' => 'packageMy/pages/myMember/detail?id=' . $this->work->getAttribute('activity_id'),
'data' => [
'first' => '恭喜,您的歌手成功达成合作',
'keyword1' => $this->work->getUserFullName(),
'keyword2' => '参与试唱《' . $this->work->getAttribute('activity_name') . '》达成合作',
'remark' => '点击查看 >'
]
];
}
}