Open altwei opened 2 years ago
官方文档 https://docs.jiguang.cn/jpush/server/push/rest_api_v3_push#%E6%8E%A8%E9%80%81%E6%92%A4%E9%94%80
我自己的解决方案 ,注意自己处理命名空间,还要修改 key 和 密钥
Aurora.php
<?php namespace xxx use InvalidArgumentException; use JPush\Client; use JPush\Http; class Aurora { const APP_KEY = 'xxx'; const MASTER_SECRET = 'xxx'; protected static $client; /** * 推送撤销 * @param $msgId * @return array */ public static function cancelMessage($msgId) { if (!is_string($msgId)) { throw new InvalidArgumentException('Invalid msg id'); } $url = Aurora::getClient()->makeURL('push') . 'push/' . $msgId; return Http::delete(Aurora::getClient(), $url); } /** * @return Client */ public static function getClient() { if (self::$client === null) { self::$client = new Client(self::APP_KEY, self::MASTER_SECRET); } return self::$client; } }
官方文档 https://docs.jiguang.cn/jpush/server/push/rest_api_v3_push#%E6%8E%A8%E9%80%81%E6%92%A4%E9%94%80
我自己的解决方案 ,注意自己处理命名空间,还要修改 key 和 密钥
Aurora.php