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