Driver.php 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | 萤火商城系统 [ 致力于通过产品和服务,帮助商家高效化开拓市场 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2017~2025 https://www.yiovo.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed 这不是一个自由软件,不允许对程序代码以任何形式任何目的的再发行
  8. // +----------------------------------------------------------------------
  9. // | Author: 萤火科技 <admin@yiovo.com>
  10. // +----------------------------------------------------------------------
  11. declare (strict_types=1);
  12. namespace app\common\library\express\provider;
  13. use cores\traits\ErrorTrait;
  14. use cores\exception\BaseException;
  15. /**
  16. * 物流查询驱动基类
  17. * Class Driver
  18. * @package app\common\library\express\provider\driver
  19. */
  20. abstract class Driver
  21. {
  22. use ErrorTrait;
  23. /**
  24. * 驱动句柄
  25. * @var Driver
  26. */
  27. protected $handler = null;
  28. /**
  29. * api配置参数
  30. * @var array
  31. */
  32. protected $options = [];
  33. /**
  34. * 查询物流轨迹
  35. * @param string $code 快递公司的编码
  36. * @param string $expressNo 查询的快递单号
  37. * @param array $extra 附加数据
  38. * @return array
  39. */
  40. abstract function query(string $code, string $expressNo, array $extra = []): array;
  41. /**
  42. * 设置api配置参数
  43. * @param array $options 配置信息
  44. * @return static|null
  45. */
  46. public function setOptions(array $options): ?Driver
  47. {
  48. $this->options = $options;
  49. return $this;
  50. }
  51. }