code-lives/app-push-tpns

v1.1.0 2022-09-06 15:33 UTC

This package is auto-updated.

Last update: 2024-09-06 12:21:40 UTC


README

官方接口文档

安装

composer require code-lives/app-push-tpns 1.1.0

配置参数说明

需要配置的参数

配置示例

本地config配置

   $config = [
       'appid' => '',
       'secretKey' => '',
       'environment'=>''
   ];

全量推送

向所有安装app的用户发送消息。

   $content=[
       'title'=>'标题',
       'content'=>'内容'
       ];
   $app_push = new AppPush($config);
   $app_push->send_all($content,'notify');

单账号推送或多账号推送

向单个用户发送消息或向多个账号发送消息

   $account=['one'];//单账号推送
   $account=['one','two'];//多个账号推送
   $app_push->send_account($content, $account,$message_type);

单设备推送或多设备推送

单或多设备推送数量判断

   $token=['one'];//单设备推送
   $token=['one','two'];//多个设备推送
   $app_push->send_token($content, $token,$message_type);

标签推送

tag字段根据开发文档tag_items字段自定义

   $app_push->send_tag($content, $tag,$message_type);

标签绑定与解绑

  //1-8
  $operator_type = 1;
  $array = ['token_list' => []];
  $tag_array = ['tag_list' => []];
  $app_push->set_tag($operator_type, $array = [], $tag_array = []);

  //9-10
  $operator_type = 9;
  $array = ['tag_token_list' => []];
  $app_push->set_tag($operator_type, $array = []);

删除标签下所有设备

   $app_push->delete_tag(['tag_list'=>[]]);

账号绑定与解绑

array根据开发文档->账号相关接口->账号绑定与解绑

  $operator_type = 1;
  $array = ['account_list' => []];
  $array = ['token_list' => []];
  $array = ['token_accounts' => []];
  $app_push->account_save($operator_type, $array);

账号查询

array根据开发文档->账号相关接口->账号设备绑定查询

  $operator_type = 1;
  $array = ['account_list' => []];
  $array = ['token_list' => []];
  $app_push->account_query($operator_type, $array);