GTAps.php 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. <?php
  2. require_once(dirname(__FILE__) . '/' . 'GTAlert.php');
  3. class GTAps extends GTApiRequest
  4. {
  5. /**
  6. * 通知消息
  7. */
  8. private $alert;
  9. /**
  10. * 推送直接带有透传数据,content-available=1表示静默推送,静默推送时不需要填写其他参数,详细参数填写见示例,苹果建议1小时最多推送3条静默消息
  11. */
  12. private $contentAvailable;
  13. /**
  14. * 通知铃声文件名,无声设置为“com.gexin.ios.silence”
  15. */
  16. private $sound;
  17. /**
  18. * 在客户端通知栏触发特定的action和button显示
  19. */
  20. private $category;
  21. //ios的远程通知通过该属性对通知进行分组,仅支持iOS 12.0以上版本
  22. private $threadId;
  23. public function getAlert()
  24. {
  25. return $this->alert;
  26. }
  27. public function setAlert($alert)
  28. {
  29. $this->alert = $alert;
  30. }
  31. public function getContentAvailable()
  32. {
  33. return $this->contentAvailable;
  34. }
  35. public function setContentAvailable($contentAvailable)
  36. {
  37. $this->contentAvailable = $contentAvailable;
  38. $this->apiParam["content-available"] = $contentAvailable;
  39. }
  40. public function getSound()
  41. {
  42. return $this->sound;
  43. }
  44. public function setSound($sound)
  45. {
  46. $this->sound = $sound;
  47. $this->apiParam["sound"] = $sound;
  48. }
  49. public function getCategory()
  50. {
  51. return $this->category;
  52. }
  53. public function setCategory($category)
  54. {
  55. $this->category = $category;
  56. $this->apiParam["category"] = $category;
  57. }
  58. public function getThreadId()
  59. {
  60. return $this->threadId;
  61. }
  62. public function setThreadId($threadId)
  63. {
  64. $this->threadId = $threadId;
  65. $this->apiParam["thread-id"] = $threadId;
  66. }
  67. public function getApiParam()
  68. {
  69. if ($this->alert != null){
  70. $this->apiParam["alert"] = $this->alert->getApiParam();
  71. }
  72. return $this->apiParam;
  73. }
  74. }