作者 赵彬吉

update

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