FetchService.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | Niucloud-admin 企业快速开发的saas管理平台
  4. // +----------------------------------------------------------------------
  5. // | 官方网址:https://www.niucloud.com
  6. // +----------------------------------------------------------------------
  7. // | niucloud团队 版权所有 开源版本可自由商用
  8. // +----------------------------------------------------------------------
  9. // | Author: Niucloud Team
  10. // +----------------------------------------------------------------------
  11. namespace app\service\api\upload;
  12. use app\service\core\upload\CoreFetchService;
  13. use core\base\BaseApiService;
  14. use Exception;
  15. /**
  16. * 用户服务层
  17. * Class BaseService
  18. * @package app\service
  19. */
  20. class FetchService extends BaseApiService
  21. {
  22. private $root_path = 'file';
  23. /**
  24. * 远程拉取图片
  25. * @param string $url
  26. * @return array
  27. * @throws Exception
  28. */
  29. public function image(string $url){
  30. $dir = $this->root_path.'/'.'image'.'/'.date('Ym').'/'.date('d');
  31. $core_upload_service = new CoreFetchService();
  32. return $core_upload_service->image($url,0, $dir);
  33. }
  34. }