diff --git a/src/Push/CommonMessage.php b/src/Push/CommonMessage.php index 85f52f6..1ae1238 100644 --- a/src/Push/CommonMessage.php +++ b/src/Push/CommonMessage.php @@ -19,6 +19,26 @@ class CommonMessage private $alias_type = ''; + private $iosBadge = ''; + + /** + * @return string + */ + public function getIosBadge() + { + return $this->iosBadge; + } + + /** + * @param string $iosBadge + * @return $this + */ + public function setIosBadge($iosBadge) + { + $this->iosBadge = $iosBadge; + return $this; + } + /** * 定制的 */ diff --git a/src/Request/SendRequest.php b/src/Request/SendRequest.php index 1eeb662..646c1e7 100644 --- a/src/Request/SendRequest.php +++ b/src/Request/SendRequest.php @@ -105,8 +105,10 @@ public function iosSend($sign, CommonMessage $commonMessage) $payload = IosPayload::make() ->setContentAvailable(true) ->setAlert($commonMessage->getTitle(), $commonMessage->getDesc(), $commonMessage->getTicker()) - ->setOtherParams($commonMessage->getOtherParams()) - ->setBadge('+1'); + ->setOtherParams($commonMessage->getOtherParams()); + if ($commonMessage->getIosBadge()) { + $payload->setBadge($commonMessage->getIosBadge()); + } $policy = Policy::make()->setOutBizNo($sign); return $this->send($message, $payload, $policy); }