CorpDingCreateRequest.php 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. <?php
  2. /**
  3. * dingtalk API: dingtalk.corp.ding.create request
  4. *
  5. * @author auto create
  6. * @since 1.0, 2019.07.03
  7. */
  8. class CorpDingCreateRequest
  9. {
  10. /**
  11. * 附件内容
  12. **/
  13. private $attachment;
  14. /**
  15. * 发送者工号
  16. **/
  17. private $creatorUserid;
  18. /**
  19. * 接收者工号列表
  20. **/
  21. private $receiverUserids;
  22. /**
  23. * 发送时间(单位:毫秒)
  24. **/
  25. private $remindTime;
  26. /**
  27. * 提醒类型:1-应用内;2-短信
  28. **/
  29. private $remindType;
  30. /**
  31. * 通知内容
  32. **/
  33. private $textContent;
  34. private $apiParas = array();
  35. public function setAttachment($attachment)
  36. {
  37. $this->attachment = $attachment;
  38. $this->apiParas["attachment"] = $attachment;
  39. }
  40. public function getAttachment()
  41. {
  42. return $this->attachment;
  43. }
  44. public function setCreatorUserid($creatorUserid)
  45. {
  46. $this->creatorUserid = $creatorUserid;
  47. $this->apiParas["creator_userid"] = $creatorUserid;
  48. }
  49. public function getCreatorUserid()
  50. {
  51. return $this->creatorUserid;
  52. }
  53. public function setReceiverUserids($receiverUserids)
  54. {
  55. $this->receiverUserids = $receiverUserids;
  56. $this->apiParas["receiver_userids"] = $receiverUserids;
  57. }
  58. public function getReceiverUserids()
  59. {
  60. return $this->receiverUserids;
  61. }
  62. public function setRemindTime($remindTime)
  63. {
  64. $this->remindTime = $remindTime;
  65. $this->apiParas["remind_time"] = $remindTime;
  66. }
  67. public function getRemindTime()
  68. {
  69. return $this->remindTime;
  70. }
  71. public function setRemindType($remindType)
  72. {
  73. $this->remindType = $remindType;
  74. $this->apiParas["remind_type"] = $remindType;
  75. }
  76. public function getRemindType()
  77. {
  78. return $this->remindType;
  79. }
  80. public function setTextContent($textContent)
  81. {
  82. $this->textContent = $textContent;
  83. $this->apiParas["text_content"] = $textContent;
  84. }
  85. public function getTextContent()
  86. {
  87. return $this->textContent;
  88. }
  89. public function getApiMethodName()
  90. {
  91. return "dingtalk.corp.ding.create";
  92. }
  93. public function getApiParas()
  94. {
  95. return $this->apiParas;
  96. }
  97. public function check()
  98. {
  99. RequestCheckUtil::checkNotNull($this->creatorUserid,"creatorUserid");
  100. RequestCheckUtil::checkNotNull($this->receiverUserids,"receiverUserids");
  101. RequestCheckUtil::checkMaxListSize($this->receiverUserids,20,"receiverUserids");
  102. RequestCheckUtil::checkNotNull($this->remindTime,"remindTime");
  103. RequestCheckUtil::checkNotNull($this->remindType,"remindType");
  104. RequestCheckUtil::checkNotNull($this->textContent,"textContent");
  105. RequestCheckUtil::checkMaxLength($this->textContent,5000,"textContent");
  106. }
  107. public function putOtherTextParam($key, $value) {
  108. $this->apiParas[$key] = $value;
  109. $this->$key = $value;
  110. }
  111. }