GTNotification.php 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256
  1. <?php
  2. class GTNotification extends GTApiRequest
  3. {
  4. /**
  5. * 第三方厂商通知标题,长度 ≤ 50
  6. */
  7. private $title;
  8. /**
  9. * 第三方厂商通知内容,长度 ≤ 256
  10. */
  11. private $body;
  12. //长文本消息内容,通知消息+长文本样式,与big_image二选一,两个都填写时报错,长度 ≤ 512
  13. private $bigText;
  14. //大图的URL地址,通知消息+大图样式, 与big_text二选一,两个都填写时报错,长度 ≤ 1024
  15. private $bigImage;
  16. //通知的图标名称,包含后缀名(需要在客户端开发时嵌入),如“push.png”,长度 ≤ 64
  17. private $logo;
  18. //通知图标URL地址,长度 ≤ 256
  19. private $logoUrl;
  20. //通知渠道id,长度 ≤ 64
  21. private $channelId;
  22. //通知渠道名称,长度 ≤ 64
  23. private $channelName;
  24. /** @var 设置通知渠道重要性(可以控制响铃,震动,浮动,闪灯等等)
  25. * android8.0以下
  26. * 0,1,2:无声音,无振动,不浮动
  27. * 3:有声音,无振动,不浮动
  28. * 4:有声音,有振动,有浮动
  29. * android8.0以上
  30. * 0:无声音,无振动,不显示;
  31. * 1:无声音,无振动,锁屏不显示,通知栏中被折叠显示,导航栏无logo;
  32. * 2:无声音,无振动,锁屏和通知栏中都显示,通知不唤醒屏幕;
  33. * 3:有声音,无振动,锁屏和通知栏中都显示,通知唤醒屏幕;
  34. * 4:有声音,有振动,亮屏下通知悬浮展示,锁屏通知以默认形式展示且唤醒屏幕;
  35. */
  36. private $channelLevel;
  37. /**
  38. * @see com.gt.sdk.dto.CommonEnum.ClickTypeEnum
  39. * 点击通知后续动作,
  40. * 目前支持5种后续动作,
  41. * intent:打开应用内特定页面,
  42. * url:打开网页地址,
  43. * payload:启动应用加自定义消息内容,
  44. * startapp:打开应用首页,
  45. * none:纯通知,无后续动作
  46. */
  47. private $clickType;
  48. /**
  49. * 点击通知打开应用特定页面,长度 ≤ 2048;
  50. * 示例:intent:#Intent;component=你的包名/你要打开的 activity 全路径;S.parm1=value1;S.parm2=value2;end
  51. */
  52. private $intent;
  53. /**
  54. * 点击通知打开链接,长度 ≤ 1024
  55. */
  56. private $url;
  57. /**
  58. * 点击通知加自定义消息,长度 ≤ 3072
  59. */
  60. private $payload;
  61. /**
  62. * 消息覆盖使用,两条消息的notify_id相同,新的消息会覆盖老的消息
  63. */
  64. private $notifyId;
  65. //自定义铃声,请填写文件名,不包含后缀名(需要在客户端开发时嵌入),个推通道下发有效,客户端SDK最低要求 2.14.0.0
  66. private $ringName;
  67. /** @var 角标,
  68. * 必须大于0, 个推通道下发有效
  69. * 此属性目前仅针对华为 EMUI 4.1 及以上设备有效
  70. * 角标数字数据会和之前角标数字进行叠加;
  71. * 举例:角标数字配置1,应用之前角标数为2,发送此角标消息后,应用角标数显示为3。
  72. * 客户端SDK最低要求 2.14.0.0
  73. */
  74. private $badgeAddNum;
  75. public function getTitle()
  76. {
  77. return $this->title;
  78. }
  79. public function setTitle($title)
  80. {
  81. $this->title = $title;
  82. $this->apiParam["title"] = $title;
  83. }
  84. public function getBody()
  85. {
  86. return $this->body;
  87. }
  88. public function setBody($body)
  89. {
  90. $this->body = $body;
  91. $this->apiParam["body"] = $body;
  92. }
  93. public function getBigText()
  94. {
  95. return $this->bigText;
  96. }
  97. public function setBigText($bigText)
  98. {
  99. $this->bigText = $bigText;
  100. $this->apiParam["big_text"] = $bigText;
  101. }
  102. public function getBigImage()
  103. {
  104. return $this->bigImage;
  105. }
  106. public function setBigImage($bigImage)
  107. {
  108. $this->bigImage = $bigImage;
  109. $this->apiParam["big_image"] = $bigImage;
  110. }
  111. public function getLogo()
  112. {
  113. return $this->logo;
  114. }
  115. public function setLogo($logo)
  116. {
  117. $this->logo = $logo;
  118. $this->apiParam["logo"] = $logo;
  119. }
  120. public function getLogoUrl()
  121. {
  122. return $this->logoUrl;
  123. }
  124. public function setLogoUrl($logoUrl)
  125. {
  126. $this->logoUrl = $logoUrl;
  127. $this->apiParam["logo_url"] = $logoUrl;
  128. }
  129. public function getChannelId()
  130. {
  131. return $this->channelId;
  132. }
  133. public function setChannelId($channelId)
  134. {
  135. $this->channelId = $channelId;
  136. $this->apiParam["channel_id"] = $channelId;
  137. }
  138. public function getChannelName()
  139. {
  140. return $this->channelName;
  141. }
  142. public function setChannelName($channelName)
  143. {
  144. $this->channelName = $channelName;
  145. $this->apiParam["channel_name"] = $channelName;
  146. }
  147. public function getChannelLevel()
  148. {
  149. return $this->channelLevel;
  150. }
  151. public function setChannelLevel($channelLevel)
  152. {
  153. $this->channelLevel = $channelLevel;
  154. $this->apiParam["channel_level"] = $channelLevel;
  155. }
  156. public function getClickType()
  157. {
  158. return $this->clickType;
  159. }
  160. public function setClickType($clickType)
  161. {
  162. $this->clickType = $clickType;
  163. $this->apiParam["click_type"] = $clickType;
  164. }
  165. public function getIntent()
  166. {
  167. return $this->intent;
  168. }
  169. public function setIntent($intent)
  170. {
  171. $this->intent = $intent;
  172. $this->apiParam["intent"] = $intent;
  173. }
  174. public function getUrl()
  175. {
  176. return $this->url;
  177. }
  178. public function setUrl($url)
  179. {
  180. $this->url = $url;
  181. $this->apiParam["url"] = $url;
  182. }
  183. public function getPayload()
  184. {
  185. return $this->payload;
  186. }
  187. public function setPayload($payload)
  188. {
  189. $this->payload = $payload;
  190. $this->apiParam["payload"] = $payload;
  191. }
  192. public function getNotifyId()
  193. {
  194. return $this->notifyId;
  195. }
  196. public function setNotifyId($notifyId)
  197. {
  198. $this->notifyId = $notifyId;
  199. $this->apiParam["notify_id"] = $notifyId;
  200. }
  201. public function getRingName()
  202. {
  203. return $this->ringName;
  204. }
  205. public function setRingName($ringName)
  206. {
  207. $this->ringName = $ringName;
  208. $this->apiParam["ring_name"] = $ringName;
  209. }
  210. public function getBadgeAddNum()
  211. {
  212. return $this->badgeAddNum;
  213. }
  214. public function setBadgeAddNum($badgeAddNum)
  215. {
  216. $this->badgeAddNum = $badgeAddNum;
  217. $this->apiParam["badge_add_num"] = $badgeAddNum;
  218. }
  219. }