'被提醒者昵称', 'is_remind_user_partner_id' => null ); /** * Create a new notification instance. * * @param int $to_uid */ public function __construct(int $to_uid) { parent::__construct($to_uid); } /** * Get the notification's delivery channels. * * @return array */ public function via(): array { return [ $this->toFpdxTemplate(), $this->toSyjTemplate(), $this->toMiniTemplate(), // $this->toQQMiniTemplate() ]; } /** * @param array $build * @return $this */ public function buildData(array $build) { $this->buildData = $build; return $this; } /** * 跳转地址 * @return string */ protected function getPagePath() { return "pages/other-friend-card/other-friend-card?partner_id={$this->buildData['is_remind_user_partner_id']}"; } /** * * @return TemplateChannel */ public function toFpdxTemplate() { $templateIds = array( [ 'template_id' => "vj03Lys62tcWH0BAx2bKdDbzxBnhwe4Fhs3GXqbxkTg", 'data' => [ 'first' => [ 'value' => "你提醒的{$this->buildData['is_remind_nickname']},已完善交友卡片~" ], 'keyword1' => [ 'value' => "提醒成功" ], 'keyword2' => [ 'value' => date('Y-m-d H:i:s') ], 'remark' => [ 'value' => "点此可查看{$this->buildData['is_remind_nickname']}详细资料", ] ] ] ); $template = $templateIds[rand(0, count($templateIds) - 1)]; $templateId = $template['template_id']; $data = $template['data']; $publicId = config("wechat.fpdx.public_id"); return new TemplateChannel($this->to_uid, $templateId, $data, $publicId); } /** * @return TemplateChannel */ public function toSyjTemplate() { $templateIds = array( [ 'template_id' => "T5AvN3tkUKywz1-hVeW2RFLNYV1Ex_EfXI0OE_JQBxM", 'data' => [ 'first' => [ 'value' => "你提醒的{$this->buildData['is_remind_nickname']},已完善交友卡片~" ], 'keyword1' => [ 'value' => date('Y-m-d H:i:s') ], 'keyword2' => [ 'value' => "提醒成功" ], 'keyword3' => [ 'value' => "点此可查看{$this->buildData['is_remind_nickname']}详细资料" ] ] ] ); $template = $templateIds[rand(0, count($templateIds) - 1)]; $templateId = $template['template_id']; $data = $template['data']; $publicId = config("wechat.fpdx.public_id"); return new TemplateChannel($this->to_uid, $templateId, $data, $publicId); } /** * @return MiniTemplateChannel */ public function toMiniTemplate() { $templateId = "THT3gLhSTLvs9Koli8wxdbKYq2_noErJKy7aov-YmMg"; $data = array( 'keyword1' => [ 'value' => "你提醒的{$this->buildData['is_remind_nickname']},已完善交友卡片~" ], 'keyword2' => [ 'value' => date('Y-m-d H:i:s') ], 'keyword3' => [ 'value' => "提醒成功" ], 'keyword4' => [ 'value' => '更新成功' ], 'keyword5' => [ 'value' => "点此可查看{$this->buildData['is_remind_nickname']}详细资料" ] ); return new MiniTemplateChannel($this->to_uid, $templateId, $data); } /** * @return QQMiniTemplateChannel */ public function toQQMiniTemplate() { $templateId = "3f90ecc0a1eed20431caee8212279ce3"; $data = array( 'keyword1' => [ 'value' => "你提醒的{$this->buildData['is_remind_nickname']},已完善交友卡片~" ], 'keyword2' => [ 'value' => date('Y-m-d H:i:s') ], 'keyword3' => [ 'value' => "提醒成功" ], 'keyword4' => [ 'value' => '更新成功' ], 'keyword5' => [ 'value' => "点此可查看{$this->buildData['is_remind_nickname']}详细资料" ] ); return (new QQMiniTemplateChannel())->setTitle($this->title) ->toUser($this->to_uid)->setTemplateId($templateId) ->setPage($this->getPagePath()) ->setParameters($data)->send(); } }