Express.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. /**
  3. *
  4. * @author: xaboy<365615158@qq.com>
  5. * @day: 2018/01/10
  6. */
  7. namespace Api;
  8. use service\HttpService;
  9. use service\SystemConfigService;
  10. class Express
  11. {
  12. protected static $api = [
  13. 'query'=>'http://jisukdcx.market.alicloudapi.com/express/query',
  14. 'type'=>'http://jisukdcx.market.alicloudapi.com/express/type'
  15. ];
  16. public static function query($number,$type = 'auto')
  17. {
  18. $appCode = SystemConfigService::config('system_express_app_code');
  19. if(!$appCode) return false;
  20. //WIKI https://market.aliyun.com/products/57126001/cmapi011120.html?spm=5176.2020520132.101.4.TYdLsb#sku=yuncode512000008
  21. $res = HttpService::getRequest(self::$api['query'],compact('number','type'),['Authorization:APPCODE '.$appCode]);
  22. $result = json_decode($res,true)?:false;
  23. return $result;
  24. }
  25. public static function type()
  26. {
  27. $appCode = SystemConfigService::config('system_express_app_code');
  28. if(!$appCode) return false;
  29. $res = HttpService::getRequest(self::$api['type'],[],['Authorization:APPCODE '.$appCode]);
  30. $result = json_decode($res,true)?:false;
  31. return $result;
  32. }
  33. }