OapiImChatScencegroupMessageSendRequest.php 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. <?php
  2. /**
  3. * dingtalk API: dingtalk.oapi.im.chat.scencegroup.message.send request
  4. *
  5. * @author auto create
  6. * @since 1.0, 2021.01.21
  7. */
  8. class OapiImChatScencegroupMessageSendRequest
  9. {
  10. /**
  11. * @人的手机号列表
  12. **/
  13. private $atMobiles;
  14. /**
  15. * 是否@所有人
  16. **/
  17. private $isAtAll;
  18. /**
  19. * 消息模板内容替换参数-多媒体类型
  20. **/
  21. private $msgMediaIdParamMap;
  22. /**
  23. * 消息模板内容替换参数-普通文本类型
  24. **/
  25. private $msgParamMap;
  26. /**
  27. * 模板ID
  28. **/
  29. private $msgTemplateId;
  30. /**
  31. * 消息接收人手机号列表(不设置任何接收人则全部可见)
  32. **/
  33. private $receiverMobiles;
  34. /**
  35. * 消息接收人 unionId 列表(不设置任何接收人则全部可见)
  36. **/
  37. private $receiverUnionIds;
  38. /**
  39. * 消息接收人 userId 列表 (不设置任何接收人则全部可见)
  40. **/
  41. private $receiverUserIds;
  42. /**
  43. * 用于发送卡片的机器人编码,与场景群模板中的机器人编码保持一致
  44. **/
  45. private $robotCode;
  46. /**
  47. * 接收消息的群的openConversationId
  48. **/
  49. private $targetOpenConversationId;
  50. private $apiParas = array();
  51. public function setAtMobiles($atMobiles)
  52. {
  53. $this->atMobiles = $atMobiles;
  54. $this->apiParas["at_mobiles"] = $atMobiles;
  55. }
  56. public function getAtMobiles()
  57. {
  58. return $this->atMobiles;
  59. }
  60. public function setIsAtAll($isAtAll)
  61. {
  62. $this->isAtAll = $isAtAll;
  63. $this->apiParas["is_at_all"] = $isAtAll;
  64. }
  65. public function getIsAtAll()
  66. {
  67. return $this->isAtAll;
  68. }
  69. public function setMsgMediaIdParamMap($msgMediaIdParamMap)
  70. {
  71. $this->msgMediaIdParamMap = $msgMediaIdParamMap;
  72. $this->apiParas["msg_media_id_param_map"] = $msgMediaIdParamMap;
  73. }
  74. public function getMsgMediaIdParamMap()
  75. {
  76. return $this->msgMediaIdParamMap;
  77. }
  78. public function setMsgParamMap($msgParamMap)
  79. {
  80. $this->msgParamMap = $msgParamMap;
  81. $this->apiParas["msg_param_map"] = $msgParamMap;
  82. }
  83. public function getMsgParamMap()
  84. {
  85. return $this->msgParamMap;
  86. }
  87. public function setMsgTemplateId($msgTemplateId)
  88. {
  89. $this->msgTemplateId = $msgTemplateId;
  90. $this->apiParas["msg_template_id"] = $msgTemplateId;
  91. }
  92. public function getMsgTemplateId()
  93. {
  94. return $this->msgTemplateId;
  95. }
  96. public function setReceiverMobiles($receiverMobiles)
  97. {
  98. $this->receiverMobiles = $receiverMobiles;
  99. $this->apiParas["receiver_mobiles"] = $receiverMobiles;
  100. }
  101. public function getReceiverMobiles()
  102. {
  103. return $this->receiverMobiles;
  104. }
  105. public function setReceiverUnionIds($receiverUnionIds)
  106. {
  107. $this->receiverUnionIds = $receiverUnionIds;
  108. $this->apiParas["receiver_union_ids"] = $receiverUnionIds;
  109. }
  110. public function getReceiverUnionIds()
  111. {
  112. return $this->receiverUnionIds;
  113. }
  114. public function setReceiverUserIds($receiverUserIds)
  115. {
  116. $this->receiverUserIds = $receiverUserIds;
  117. $this->apiParas["receiver_user_ids"] = $receiverUserIds;
  118. }
  119. public function getReceiverUserIds()
  120. {
  121. return $this->receiverUserIds;
  122. }
  123. public function setRobotCode($robotCode)
  124. {
  125. $this->robotCode = $robotCode;
  126. $this->apiParas["robot_code"] = $robotCode;
  127. }
  128. public function getRobotCode()
  129. {
  130. return $this->robotCode;
  131. }
  132. public function setTargetOpenConversationId($targetOpenConversationId)
  133. {
  134. $this->targetOpenConversationId = $targetOpenConversationId;
  135. $this->apiParas["target_open_conversation_id"] = $targetOpenConversationId;
  136. }
  137. public function getTargetOpenConversationId()
  138. {
  139. return $this->targetOpenConversationId;
  140. }
  141. public function getApiMethodName()
  142. {
  143. return "dingtalk.oapi.im.chat.scencegroup.message.send";
  144. }
  145. public function getApiParas()
  146. {
  147. return $this->apiParas;
  148. }
  149. public function check()
  150. {
  151. RequestCheckUtil::checkMaxListSize($this->atMobiles,999,"atMobiles");
  152. RequestCheckUtil::checkNotNull($this->msgTemplateId,"msgTemplateId");
  153. RequestCheckUtil::checkMaxListSize($this->receiverMobiles,999,"receiverMobiles");
  154. RequestCheckUtil::checkMaxListSize($this->receiverUnionIds,999,"receiverUnionIds");
  155. RequestCheckUtil::checkMaxListSize($this->receiverUserIds,999,"receiverUserIds");
  156. RequestCheckUtil::checkNotNull($this->robotCode,"robotCode");
  157. RequestCheckUtil::checkNotNull($this->targetOpenConversationId,"targetOpenConversationId");
  158. }
  159. public function putOtherTextParam($key, $value) {
  160. $this->apiParas[$key] = $value;
  161. $this->$key = $value;
  162. }
  163. }