OapiRobotSendRequest.php 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. <?php
  2. /**
  3. * dingtalk API: dingtalk.oapi.robot.send request
  4. *
  5. * @author auto create
  6. * @since 1.0, 2021.05.26
  7. */
  8. class OapiRobotSendRequest
  9. {
  10. /**
  11. * 此消息类型为固定actionCard
  12. **/
  13. private $actionCard;
  14. /**
  15. * 被@人的手机号
  16. **/
  17. private $at;
  18. /**
  19. * 此消息类型为固定feedCard
  20. **/
  21. private $feedCard;
  22. /**
  23. * 消息类型,此时固定为:link
  24. **/
  25. private $link;
  26. /**
  27. * 此消息类型为固定markdown
  28. **/
  29. private $markdown;
  30. /**
  31. * 消息类型
  32. **/
  33. private $msgtype;
  34. /**
  35. * text类型
  36. **/
  37. private $text;
  38. private $apiParas = array();
  39. public function setActionCard($actionCard)
  40. {
  41. $this->actionCard = $actionCard;
  42. $this->apiParas["actionCard"] = $actionCard;
  43. }
  44. public function getActionCard()
  45. {
  46. return $this->actionCard;
  47. }
  48. public function setAt($at)
  49. {
  50. $this->at = $at;
  51. $this->apiParas["at"] = $at;
  52. }
  53. public function getAt()
  54. {
  55. return $this->at;
  56. }
  57. public function setFeedCard($feedCard)
  58. {
  59. $this->feedCard = $feedCard;
  60. $this->apiParas["feedCard"] = $feedCard;
  61. }
  62. public function getFeedCard()
  63. {
  64. return $this->feedCard;
  65. }
  66. public function setLink($link)
  67. {
  68. $this->link = $link;
  69. $this->apiParas["link"] = $link;
  70. }
  71. public function getLink()
  72. {
  73. return $this->link;
  74. }
  75. public function setMarkdown($markdown)
  76. {
  77. $this->markdown = $markdown;
  78. $this->apiParas["markdown"] = $markdown;
  79. }
  80. public function getMarkdown()
  81. {
  82. return $this->markdown;
  83. }
  84. public function setMsgtype($msgtype)
  85. {
  86. $this->msgtype = $msgtype;
  87. $this->apiParas["msgtype"] = $msgtype;
  88. }
  89. public function getMsgtype()
  90. {
  91. return $this->msgtype;
  92. }
  93. public function setText($text)
  94. {
  95. $this->text = $text;
  96. $this->apiParas["text"] = $text;
  97. }
  98. public function getText()
  99. {
  100. return $this->text;
  101. }
  102. public function getApiMethodName()
  103. {
  104. return "dingtalk.oapi.robot.send";
  105. }
  106. public function getApiParas()
  107. {
  108. return $this->apiParas;
  109. }
  110. public function check()
  111. {
  112. RequestCheckUtil::checkNotNull($this->msgtype,"msgtype");
  113. }
  114. public function putOtherTextParam($key, $value) {
  115. $this->apiParas[$key] = $value;
  116. $this->$key = $value;
  117. }
  118. }