作者 赵彬吉

update

@@ -88,9 +88,10 @@ class InquiryController extends BaseController @@ -88,9 +88,10 @@ class InquiryController extends BaseController
88 $table = new BatchExportService("询盘数据导出"); 88 $table = new BatchExportService("询盘数据导出");
89 $file = $table->head($map)->data($data)->save(); 89 $file = $table->head($map)->data($data)->save();
90 if (!$file) { 90 if (!$file) {
91 - throw new \Exception('路由不能为空'); 91 + throw new \Exception('文件生成失败,请重试');
92 } 92 }
93 $fileurl = Storage::disk('runtime')->url($file); 93 $fileurl = Storage::disk('runtime')->url($file);
  94 +// return Storage::disk('runtime')->download($file); //直接下载
94 return $this->success(['url' => $fileurl]); 95 return $this->success(['url' => $fileurl]);
95 } 96 }
96 } 97 }
@@ -87,8 +87,8 @@ class BatchExportService @@ -87,8 +87,8 @@ class BatchExportService
87 */ 87 */
88 public function save() 88 public function save()
89 { 89 {
90 - $file = "runtime/export/".date('Y-m-d')."/{$this->name}_" . date('YmdHis') . ".xlsx";  
91 - $filename = public_path($file); 90 + $file = "export/".date('Y-m-d')."/{$this->name}_" . date('YmdHis') . ".xlsx";
  91 + $filename = public_path('runtime/'.$file);
92 92
93 if (!is_dir(dirname($filename))) { 93 if (!is_dir(dirname($filename))) {
94 @mkdir(dirname($filename),0755, true); 94 @mkdir(dirname($filename),0755, true);
@@ -63,7 +63,7 @@ return [ @@ -63,7 +63,7 @@ return [
63 'runtime' => [ 63 'runtime' => [
64 'driver' => 'local', 64 'driver' => 'local',
65 'root' => public_path('runtime'), 65 'root' => public_path('runtime'),
66 - 'url' => env('APP_URL'), 66 + 'url' => env('APP_URL').'/runtime',
67 'visibility' => 'public', 67 'visibility' => 'public',
68 ], 68 ],
69 69