update2022

This commit is contained in:
2022-05-08 17:00:49 +08:00
parent 769b276649
commit 0943735bf8
6 changed files with 25 additions and 13 deletions

View File

@@ -9,6 +9,7 @@ use Illuminate\Database\Eloquent\Model;
use PhpOffice\PhpWord\Exception\CopyFileException;
use PhpOffice\PhpWord\Exception\CreateTemporaryFileException;
use PhpOffice\PhpWord\TemplateProcessor;
use RuntimeException;
class DestroyData extends RowAction
{
@@ -24,7 +25,7 @@ class DestroyData extends RowAction
{
try {
if ($model->archives) {
// return $this->response()->error('数据销毁失败')->refresh();
// return $this->response()->error('数据销毁失败')->refresh();
}
// 先做存档
$archives = [];
@@ -47,10 +48,10 @@ class DestroyData extends RowAction
$download = $this->exportEqual($model);
}
// $model->logs()->delete();
$model->logs()->delete();
return $this->response()->success('数据销毁完成')->refresh()->download($download);
} catch (\RuntimeException $exception) {
} catch (RuntimeException $exception) {
return $this->response()->error('数据销毁失败'.$exception->getMessage())->refresh();
}
}
@@ -69,8 +70,8 @@ class DestroyData extends RowAction
{
$templateProcessor = new TemplateProcessor(storage_path('app/public/DENG_FEN.docx'));
$templateProcessor->setValue('TOTAL1', $vote->logs()->distinct('user_id')->count());
$templateProcessor->setValue('TITLE', $vote->title);
$templateProcessor->setValue('TOTAL', $vote->logs()->distinct('user_id')->count());
$templateProcessor->setValue('TITLE', strip_tags($vote->title));
$i = 0;
$tpl = '';