作者 lyh

gx

@@ -304,4 +304,21 @@ class FileController @@ -304,4 +304,21 @@ class FileController
304 ]; 304 ];
305 return $data; 305 return $data;
306 } 306 }
  307 +
  308 + /**
  309 + * @remark :获取下载链接
  310 + * @name :getDownloadUrl
  311 + * @author :lyh
  312 + * @method :post
  313 + * @time :2023/7/26 14:00
  314 + */
  315 + public function getDownloadUrl(){
  316 + $fileModel = new File();
  317 + $info = $fileModel->read(['path' => $this->param['path']]);
  318 + if ($info === false) {
  319 + $this->response('指定文件不存在!', Code::USER_ERROR);
  320 + }
  321 + $data = ['file_download'=>url('a/downLoad/files?path='.$info['path'])];
  322 + $this->response('success',Code::SUCCESS,$data);
  323 + }
307 } 324 }
@@ -396,4 +396,20 @@ class ImageController extends Controller @@ -396,4 +396,20 @@ class ImageController extends Controller
396 return $data; 396 return $data;
397 } 397 }
398 398
  399 + /**
  400 + * @remark :获取下载链接
  401 + * @name :getDownloadUrl
  402 + * @author :lyh
  403 + * @method :post
  404 + * @time :2023/7/26 14:00
  405 + */
  406 + public function getDownloadUrl(){
  407 + $imageModel = new ImageModel();
  408 + $info = $imageModel->read(['path' => str_replace_url($this->param['path'])]);
  409 + if ($info === false) {
  410 + $this->response('指定文件不存在!', Code::USER_ERROR);
  411 + }
  412 + $data = ['image_download'=>url('a/downLoad/images?path='.$info['path'])];
  413 + $this->response('success',Code::SUCCESS,$data);
  414 + }
399 } 415 }