OapiCrmContactCreateRequest.php 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. <?php
  2. /**
  3. * dingtalk API: dingtalk.oapi.crm.contact.create request
  4. *
  5. * @author auto create
  6. * @since 1.0, 2022.04.12
  7. */
  8. class OapiCrmContactCreateRequest
  9. {
  10. /**
  11. * 联系人姓名
  12. **/
  13. private $contactName;
  14. /**
  15. * 联系人手机号
  16. **/
  17. private $contactPhone;
  18. /**
  19. * 联系人职位
  20. **/
  21. private $contactPositionList;
  22. /**
  23. * 创建人用户 ID
  24. **/
  25. private $creatorUserid;
  26. /**
  27. * 所在客户实例 ID
  28. **/
  29. private $customerInstanceId;
  30. /**
  31. * 服务商组织id, 特殊场景使用,丁税宝客户自建应用时传入对应的丁税宝服务商id用以生成 UnionId 关联自然人
  32. **/
  33. private $providerCorpid;
  34. private $apiParas = array();
  35. public function setContactName($contactName)
  36. {
  37. $this->contactName = $contactName;
  38. $this->apiParas["contact_name"] = $contactName;
  39. }
  40. public function getContactName()
  41. {
  42. return $this->contactName;
  43. }
  44. public function setContactPhone($contactPhone)
  45. {
  46. $this->contactPhone = $contactPhone;
  47. $this->apiParas["contact_phone"] = $contactPhone;
  48. }
  49. public function getContactPhone()
  50. {
  51. return $this->contactPhone;
  52. }
  53. public function setContactPositionList($contactPositionList)
  54. {
  55. $this->contactPositionList = $contactPositionList;
  56. $this->apiParas["contact_position_list"] = $contactPositionList;
  57. }
  58. public function getContactPositionList()
  59. {
  60. return $this->contactPositionList;
  61. }
  62. public function setCreatorUserid($creatorUserid)
  63. {
  64. $this->creatorUserid = $creatorUserid;
  65. $this->apiParas["creator_userid"] = $creatorUserid;
  66. }
  67. public function getCreatorUserid()
  68. {
  69. return $this->creatorUserid;
  70. }
  71. public function setCustomerInstanceId($customerInstanceId)
  72. {
  73. $this->customerInstanceId = $customerInstanceId;
  74. $this->apiParas["customer_instance_id"] = $customerInstanceId;
  75. }
  76. public function getCustomerInstanceId()
  77. {
  78. return $this->customerInstanceId;
  79. }
  80. public function setProviderCorpid($providerCorpid)
  81. {
  82. $this->providerCorpid = $providerCorpid;
  83. $this->apiParas["provider_corpid"] = $providerCorpid;
  84. }
  85. public function getProviderCorpid()
  86. {
  87. return $this->providerCorpid;
  88. }
  89. public function getApiMethodName()
  90. {
  91. return "dingtalk.oapi.crm.contact.create";
  92. }
  93. public function getApiParas()
  94. {
  95. return $this->apiParas;
  96. }
  97. public function check()
  98. {
  99. RequestCheckUtil::checkNotNull($this->contactName,"contactName");
  100. RequestCheckUtil::checkMaxLength($this->contactName,20,"contactName");
  101. RequestCheckUtil::checkNotNull($this->contactPhone,"contactPhone");
  102. RequestCheckUtil::checkMaxLength($this->contactPhone,15,"contactPhone");
  103. RequestCheckUtil::checkMaxListSize($this->contactPositionList,999,"contactPositionList");
  104. RequestCheckUtil::checkNotNull($this->creatorUserid,"creatorUserid");
  105. RequestCheckUtil::checkNotNull($this->customerInstanceId,"customerInstanceId");
  106. RequestCheckUtil::checkMaxLength($this->customerInstanceId,50,"customerInstanceId");
  107. }
  108. public function putOtherTextParam($key, $value) {
  109. $this->apiParas[$key] = $value;
  110. $this->$key = $value;
  111. }
  112. }