title = '上传报告提醒'; $this->url = config('user.web.base'); } public function via(): array { return [DatabaseChannel::class, WechatMiniChannel::class]; } /** * Notes: 喝水打卡提醒 * * @Author: 玄尘 * @Date: 2022/8/8 8:48 * @param User $notifiable * @return bool */ public function toWeChat(User $notifiable): bool { if ($notifiable->isOfficialSubscribe()) { $app = app('wechat.official_account'); $app->template_message->send([ 'touser' => $notifiable->wechat->official_openid, 'template_id' => '3sksrHdMTu3k1yderqyP5hOYXWltNf-CvESRG4r3Fnc', 'url' => $this->url, 'data' => [ 'first' => $this->title, 'keyword1' => now(), 'keyword2' => '您已经连续打卡30天,请上传报告', 'remark' => '', ], ]); } return true; } /** * 发送到数据库 * * @param mixed $notifiable * @return array */ public function toDatabase(User $notifiable): array { return [ 'title' => $this->title, 'content' => '您已经连续打卡30天,请上传报告', 'url' => $this->url, ]; } }