説明なし

TargetedMessage.php 884B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. /**
  3. * 要发送的消息内容和消息的发送目标.
  4. * @author wangkuiwei
  5. * @name TargetedMessage
  6. * @desc 构建要发送的消息内容和消息的发送目标。
  7. *
  8. */
  9. namespace xmpush;
  10. class TargetedMessage {
  11. const TARGET_TYPE_REGID = 1;
  12. const TARGET_TYPE_ALIAS = 2;
  13. const TARGET_TYPE_USER_ACCOUNT = 3;
  14. private $targetType;
  15. private $target;
  16. /**
  17. * @var Message
  18. */
  19. private $message;
  20. public function __construct() {
  21. }
  22. public function setTarget($target, $targetType) {
  23. $this->targetType = $targetType;
  24. $this->target = $target;
  25. }
  26. public function setMessage(Message $message) {
  27. $this->message = $message;
  28. }
  29. public function getFields() {
  30. return array(
  31. 'target' => $this->target,
  32. 'message' => $this->message->getJSONInfos()
  33. );
  34. }
  35. }
  36. ?>