admin delete

main
panliang 2024-05-03 21:47:47 +08:00
parent 55379ca25a
commit db7395fe36
5 changed files with 4 additions and 19 deletions

View File

@ -84,7 +84,10 @@ abstract class AdminController extends Controller
try {
DB::beginTransaction();
$this->service->delete($ids);
$result = $this->service->delete($ids);
if ($result === false) {
admin_abort($this->service->getError());
}
DB::commit();
} catch (Throwable $th) {

View File

@ -118,15 +118,6 @@ class EmployeeSignRepairService extends BaseService
{
$list = $this->query()->with(['workflow'])->whereIn('id', explode(',', $ids))->get();
foreach ($list as $item) {
$workflow = $item->workflow;
if ($workflow) {
if ($workflow->check_status == CheckStatus::Processing) {
throw new RuntimeException(CheckStatus::Processing->text() . ', 无法删除');
}
if ($workflow->check_status == CheckStatus::Success) {
throw new RuntimeException(CheckStatus::Success->text() . ', 无法删除');
}
}
$item->delete();
}
return true;

View File

@ -116,9 +116,6 @@ class HolidayApplyService extends BaseService
{
$list = $this->query()->with(['workflow'])->whereIn('id', explode(',', $ids))->get();
foreach ($list as $item) {
if (!$item->canUpdate()) {
return $this->setError('审核中, 无法删除');
}
$item->delete();
}
return true;

View File

@ -116,9 +116,6 @@ class OfficalBusinessService extends BaseService
{
$list = $this->query()->with(['workflow'])->whereIn('id', explode(',', $ids))->get();
foreach ($list as $item) {
if (!$item->canUpdate()) {
return $this->setError('审核中, 无法删除');
}
$item->delete();
}
return true;

View File

@ -126,9 +126,6 @@ class OvertimeApplyService extends BaseService
{
$list = $this->query()->with(['workflow'])->whereIn('id', explode(',', $ids))->get();
foreach ($list as $item) {
if (!$item->canUpdate()) {
return $this->setError('审核中, 无法删除');
}
$item->delete();
}
return true;