wujie/youmeng

友盟消息推送

1.16.0 2022-10-21 08:18 UTC

This package is auto-updated.

Last update: 2024-12-21 12:55:45 UTC


README

安装


composer require wujie/youmeng

demo

设置配置文件

<?php
$config = new \Youmeng\Config\Config([
    'appKey' => '',
    'masterSecret' => '',
    'retryNum' => 1,//失败重试次数
    'production_mode' => 'true'
]);

推送

<?php

$comMessage = (new \Youmeng\Push\CommonMessage())
    ->setTitle("")
    ->setDesc("")
    ->setMessageType(\Youmeng\Push\Message::TYPE_CUSTOMIZE_CAST)
    ->setMessageData($alidateId)
    ->setOtherParams([]);

$sendRequest = new \Youmeng\Request\SendRequest($config);
$data = $sendRequest->androidMessage($signId, $comMessage);

查询推送状态

<?php
(new \Youmeng\Request\StatusRequest($config))->status($taskId);

取消定时任务

<?php
(new \Youmeng\Request\CancelRequest($config))->cancel($taskId);

上传任务

<?php

(new \Youmeng\Request\UpdateRequest($config))->update($content);