generated from liutk/owl-admin-base
main
parent
c39c3c3f3c
commit
f017c9c5ad
|
|
@ -45,9 +45,10 @@ class AgreementController extends AdminController
|
|||
$this->applyAction(),
|
||||
$this->cancelAction(),
|
||||
amisMake()->AjaxAction()
|
||||
->level('link')
|
||||
->label('打包下载')
|
||||
->api('post:'.admin_url('agreement/download?id=${id}'))
|
||||
->api(admin_url('agreement/download?id=${id}'))
|
||||
->level('link')
|
||||
->redirect(url('admin-api/_download_export') . '?path=${path}')
|
||||
->visible($user->can('admin.agreement.download'))
|
||||
->visibleOn('${workflow.check_status == '.CheckStatus::Success->value.'}'),
|
||||
]),
|
||||
|
|
@ -109,16 +110,16 @@ class AgreementController extends AdminController
|
|||
if (!$model->images || count($model->images) == 0) {
|
||||
return $this->response()->fail('没有图片下载');
|
||||
}
|
||||
$baseUrl = Storage::url('');
|
||||
$zip = new \ZipArchive();
|
||||
$filename = Storage::path(time().'.zip');
|
||||
$zip->open($filename, \ZipArchive::CREATE | \ZipArchive::OVERWRITE);
|
||||
$filename = time().'.zip';
|
||||
$filepath = storage_path('app/' . $filename);
|
||||
$zip->open($filepath, \ZipArchive::CREATE | \ZipArchive::OVERWRITE);
|
||||
foreach($model->images as $item) {
|
||||
$path = data_get($item, 'value');
|
||||
$info = pathinfo($path);
|
||||
$zip->addFile(Storage::path($path), data_get($info, 'basename'));
|
||||
$zip->addFile(Storage::disk('public')->path($path), data_get($info, 'basename'));
|
||||
}
|
||||
$zip->close();
|
||||
return response()->download($filename)->deleteFileAfterSend();
|
||||
return $this->response()->success(['path' => $filename]);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ return [
|
|||
],
|
||||
],
|
||||
'except' => [
|
||||
|
||||
|
||||
],
|
||||
],
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue