"提醒者昵称", 'is_remind_nickname' => '被提醒者昵称' ); /** * Create a new notification instance. * * @param $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/my-friend-card-editor/my-friend-card-editor"; } /** * * @return TemplateChannel */ public function toFpdxTemplate() { $templateIds = array( [ 'template_id' => "MsktKh_eS5HMnjmCGznVYZFTAAm2JGHQfXmZgJNt4Qk", 'data' => [ 'first' => [ 'value' => "{$this->buildData['remind_nickname']}对你的资料很感兴趣,邀请你完善交友卡片~" ], 'keyword1' => [ 'value' => "{$this->buildData['is_remind_nickname']}" ], 'keyword2' => [ 'value' => "邀请你完善交友卡片" ], 'keyword3' => [ 'value' => date('Y-m-d') ], 'remark' => [ 'value' => "点此继续补全信息,可获得更高曝光度~", ] ] ], [ 'template_id' => "aDsZW0gzbSTcEwxzqC44Cq-luC-8YHLp8CaPCrWAlBo", 'data' => [ 'first' => [ 'value' => "{$this->buildData['remind_nickname']}对你的资料很感兴趣,邀请你完善交友卡片~" ], 'keyword1' => [ 'value' => "{$this->buildData['is_remind_nickname']}" ], 'keyword2' => [ 'value' => "邀请你完善交友卡片" ], 'keyword3' => [ 'value' => date('Y-m-d') ], 'remark' => [ 'value' => "点此继续补全信息,可获得更高曝光度~", ] ] ] ); $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' => "RJNTbLGdlK7tLRgt5uoKIEWxlB7-bwCdwgE5yR11aHk", 'data' => [ 'first' => [ 'value' => "{$this->buildData['remind_nickname']}对你的资料很感兴趣,邀请你完善交友卡片~" ], 'keyword1' => [ 'value' => "{$this->buildData['is_remind_nickname']}" ], 'keyword2' => [ 'value' => "邀请你完善交友卡片" ], 'keyword3' => [ 'value' => date('Y-m-d') ], 'remark' => [ 'value' => "点此继续补全信息,可获得更高曝光度~", ] ] ], [ 'template_id' => "buiSCGP-jKweNEVi7V8ZK-8Lspem1FopbD5Kvupg1Ig", 'data' => [ 'first' => [ 'value' => "{$this->buildData['remind_nickname']}对你的资料很感兴趣,邀请你完善交友卡片~" ], 'keyword1' => [ 'value' => "{$this->buildData['is_remind_nickname']}" ], 'keyword2' => [ 'value' => "邀请你完善交友卡片" ], 'keyword3' => [ 'value' => date('Y-m-d') ], 'remark' => [ 'value' => "点此继续补全信息,可获得更高曝光度~", ] ] ] ); $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 = "hc6Av4hGLXLzcVgc4JkDNmrYJ18rztBPU_NCfYUNy7U"; $data = array( 'keyword1' => [ 'value' => "{$this->buildData['remind_nickname']}对你的资料很感兴趣,邀请你完善交友卡片~" ], 'keyword2' => [ 'value' => "点此继续补全信息,可获得更高曝光度~" ], 'keyword3' => [ 'value' => "{$this->buildData['is_remind_nickname']}" ], ); return new MiniTemplateChannel($this->to_uid, $templateId, $data); } /** * @return QQMiniTemplateChannel */ public function toQQMiniTemplate() { $templateId = "481d4c5aaeb77b6b0cc3b962edd0e54d"; $data = array( 'keyword1' => [ 'value' => "{$this->buildData['remind_nickname']}对你的资料很感兴趣,邀请你完善交友卡片~" ], 'keyword2' => [ 'value' => "邀请你完善交友卡片" ], 'keyword3' => [ 'value' => "点此继续补全信息,可获得更高曝光度~" ], ); return (new QQMiniTemplateChannel()) ->setAppId('1109365561') ->setTitle($this->title) ->setPage($this->getPagePath()) ->toUser($this->to_uid) ->setTemplateId($templateId) ->setParameters($data) ->send(); } }