OapiOcrStructuredRecognizeRequest.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <?php
  2. /**
  3. * dingtalk API: dingtalk.oapi.ocr.structured.recognize request
  4. *
  5. * @author auto create
  6. * @since 1.0, 2020.02.07
  7. */
  8. class OapiOcrStructuredRecognizeRequest
  9. {
  10. /**
  11. * 识别图片地址
  12. **/
  13. private $imageUrl;
  14. /**
  15. * 识别图片类型, 身份证idcard,营业执照增值税发票invoice,营业执照blicense,银行卡bank_card,车牌car_no,机动车发票car_invoice,驾驶证driving_license,行驶证vehicle_license,火车票train_ticket,定额发票quota_invoice,出租车发票taxi_ticket,机票行程单air_itinerary
  16. **/
  17. private $type;
  18. private $apiParas = array();
  19. public function setImageUrl($imageUrl)
  20. {
  21. $this->imageUrl = $imageUrl;
  22. $this->apiParas["image_url"] = $imageUrl;
  23. }
  24. public function getImageUrl()
  25. {
  26. return $this->imageUrl;
  27. }
  28. public function setType($type)
  29. {
  30. $this->type = $type;
  31. $this->apiParas["type"] = $type;
  32. }
  33. public function getType()
  34. {
  35. return $this->type;
  36. }
  37. public function getApiMethodName()
  38. {
  39. return "dingtalk.oapi.ocr.structured.recognize";
  40. }
  41. public function getApiParas()
  42. {
  43. return $this->apiParas;
  44. }
  45. public function check()
  46. {
  47. RequestCheckUtil::checkNotNull($this->imageUrl,"imageUrl");
  48. RequestCheckUtil::checkMaxLength($this->imageUrl,1000,"imageUrl");
  49. RequestCheckUtil::checkNotNull($this->type,"type");
  50. }
  51. public function putOtherTextParam($key, $value) {
  52. $this->apiParas[$key] = $value;
  53. $this->$key = $value;
  54. }
  55. }