cqp hace 3 meses
padre
commit
c7fd9ceed1
Se han modificado 2 ficheros con 7 adiciones y 0 borrados
  1. 6 0
      app/Http/Controllers/Api/ExportFileController.php
  2. 1 0
      routes/api.php

+ 6 - 0
app/Http/Controllers/Api/ExportFileController.php

@@ -19,4 +19,10 @@ class ExportFileController extends BaseController
             return $this->json_return(201,$data);
         }
     }
+
+    //获取文件的位置
+    public function getExport($file_name){
+        $path = storage_path() . "/app/public/export/".$file_name;
+        return response()->file($path)->deleteFileAfterSend(true);
+    }
 }

+ 1 - 0
routes/api.php

@@ -17,6 +17,7 @@ use Illuminate\Http\Request;
 Route::any('login', 'Api\LoginController@login');
 //文件获取
 Route::any('uploadFiles/{file_name}', 'Api\FileUploadController@getFile');
+Route::any('getExport/{file_name}','Api\ExportFileController@getExport');
 
 Route::group(['middleware'=> ['checkLogin']],function ($route){
     //文件上传统一方法