Kuaidi.php 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | 萤火商城系统 [ 致力于通过产品和服务,帮助商家高效化开拓市场 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2017~2021 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\service;
  13. use app\common\enum\Setting as SettingEnum;
  14. use app\common\library\express\Kuaidi100;
  15. use app\common\model\store\Setting as SettingModel;
  16. /**
  17. * 订单服务类
  18. * Class Order
  19. * @package app\common\service
  20. */
  21. class Kuaidi extends BaseService
  22. {
  23. //订阅请求接口
  24. public static function subscribe($expressNo, $type=1, $company=''){
  25. // 获取快递100配置项
  26. $config = SettingModel::getItem(SettingEnum::DELIVERY);
  27. if (empty($config['kuaidi100']['customer']) || empty($config['kuaidi100']['key'])) {
  28. throwError('请先到后台-设置-配送方式 补充物流查询API配置');
  29. }
  30. // 实例化快递100类
  31. $Kuaidi100 = new Kuaidi100($config['kuaidi100']);
  32. // 请求订阅接口
  33. return $Kuaidi100->subscribe($expressNo, $type, $company);
  34. }
  35. }