123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596 |
- <?php
- namespace App\Services\NoticeService;
- use App\Services\NoticeService\Channels\KfAccountChannel;
- use App\Services\NoticeService\Channels\MiniTemplateChannel;
- use App\Services\NoticeService\Channels\TemplateChannel;
- class DemoNotification extends Notification
- {
- protected $title = "";
- public function __construct($to_uid)
- {
- parent::__construct($to_uid);
- }
- /**
- * 是否订阅
- * @return bool
- */
- public function subscribe(): bool
- {
- return true;
- }
- /**
- * 节流阀
- * @return bool
- */
- public function throttle(): bool
- {
- return true;
- }
- /**
- * 通知渠道
- * @return array
- */
- public function via(): array
- {
- return [
- $this->toKfAccount(),
- $this->toTemplate(),
- $this->toMiniTemplate(),
- ];
- }
- /**
- * 客服通知
- * @return KfAccountChannel
- */
- public function toKfAccount()
- {
- $content = "";
- $channel = new KfAccountChannel($this->to_uid, $content);
- return $channel;
- }
- /**
- * 模版消息
- * @return TemplateChannel
- */
- public function toTemplate()
- {
- $templateId = "";
- $data = [];
- return new TemplateChannel($this->to_uid, $templateId, $data);
- }
- /**
- * 小程序模版消息
- * @return MiniTemplateChannel
- */
- public function toMiniTemplate()
- {
- $templateId = "";
- $data = [];
- return new MiniTemplateChannel($this->to_uid, $templateId, $data);
- }
- protected function getPagePath()
- {
- return parent::getPagePath();
- }
- }
|