OapiMessageCorpconversationAsyncsendRequest.php 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. <?php
  2. /**
  3. * dingtalk API: dingtalk.oapi.message.corpconversation.asyncsend request
  4. *
  5. * @author auto create
  6. * @since 1.0, 2019.07.03
  7. */
  8. class OapiMessageCorpconversationAsyncsendRequest
  9. {
  10. /**
  11. * 微应用的id
  12. **/
  13. private $agentId;
  14. /**
  15. * 接收者的部门id列表
  16. **/
  17. private $deptIdList;
  18. /**
  19. * 与msgtype对应的消息体,具体见文档
  20. **/
  21. private $msgcontent;
  22. /**
  23. * 消息类型,如text、file、oa等,具体见文档
  24. **/
  25. private $msgtype;
  26. /**
  27. * 是否发送给企业全部用户
  28. **/
  29. private $toAllUser;
  30. /**
  31. * 接收者的用户userid列表
  32. **/
  33. private $useridList;
  34. private $apiParas = array();
  35. public function setAgentId($agentId)
  36. {
  37. $this->agentId = $agentId;
  38. $this->apiParas["agent_id"] = $agentId;
  39. }
  40. public function getAgentId()
  41. {
  42. return $this->agentId;
  43. }
  44. public function setDeptIdList($deptIdList)
  45. {
  46. $this->deptIdList = $deptIdList;
  47. $this->apiParas["dept_id_list"] = $deptIdList;
  48. }
  49. public function getDeptIdList()
  50. {
  51. return $this->deptIdList;
  52. }
  53. public function setMsgcontent($msgcontent)
  54. {
  55. $this->msgcontent = $msgcontent;
  56. $this->apiParas["msgcontent"] = $msgcontent;
  57. }
  58. public function getMsgcontent()
  59. {
  60. return $this->msgcontent;
  61. }
  62. public function setMsgtype($msgtype)
  63. {
  64. $this->msgtype = $msgtype;
  65. $this->apiParas["msgtype"] = $msgtype;
  66. }
  67. public function getMsgtype()
  68. {
  69. return $this->msgtype;
  70. }
  71. public function setToAllUser($toAllUser)
  72. {
  73. $this->toAllUser = $toAllUser;
  74. $this->apiParas["to_all_user"] = $toAllUser;
  75. }
  76. public function getToAllUser()
  77. {
  78. return $this->toAllUser;
  79. }
  80. public function setUseridList($useridList)
  81. {
  82. $this->useridList = $useridList;
  83. $this->apiParas["userid_list"] = $useridList;
  84. }
  85. public function getUseridList()
  86. {
  87. return $this->useridList;
  88. }
  89. public function getApiMethodName()
  90. {
  91. return "dingtalk.oapi.message.corpconversation.asyncsend";
  92. }
  93. public function getApiParas()
  94. {
  95. return $this->apiParas;
  96. }
  97. public function check()
  98. {
  99. RequestCheckUtil::checkNotNull($this->agentId,"agentId");
  100. RequestCheckUtil::checkMaxListSize($this->deptIdList,20,"deptIdList");
  101. RequestCheckUtil::checkNotNull($this->msgcontent,"msgcontent");
  102. RequestCheckUtil::checkNotNull($this->msgtype,"msgtype");
  103. RequestCheckUtil::checkMaxListSize($this->useridList,100,"useridList");
  104. }
  105. public function putOtherTextParam($key, $value) {
  106. $this->apiParas[$key] = $value;
  107. $this->$key = $value;
  108. }
  109. }