generated from liutk/owl-admin-base
店长提成操作校验
parent
1b993b3f76
commit
39b48d1c85
|
|
@ -4,6 +4,7 @@ namespace App\Admin\Services\Finance;
|
|||
|
||||
use App\Admin\Filters\StoreMasterCommissionFilter;
|
||||
use App\Admin\Services\BaseService;
|
||||
use App\Enums\CheckStatus;
|
||||
use App\Models\Store;
|
||||
use App\Models\StoreMasterCommission;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
|
|
@ -73,6 +74,15 @@ class StoreMasterCommissionService extends BaseService
|
|||
|
||||
$model = $this->query()->whereKey($primaryKey)->firstOrFail();
|
||||
|
||||
switch ($model->workflow->check_status) {
|
||||
case CheckStatus::Processing:
|
||||
admin_abort('不能修改审核中的店长提成记录');
|
||||
break;
|
||||
case CheckStatus::Success:
|
||||
admin_abort('不能修改审核通过的店长提成记录');
|
||||
break;
|
||||
}
|
||||
|
||||
foreach ([
|
||||
'month',
|
||||
'store_id',
|
||||
|
|
@ -105,6 +115,18 @@ class StoreMasterCommissionService extends BaseService
|
|||
return true;
|
||||
}
|
||||
|
||||
public function preDelete(array $ids): void
|
||||
{
|
||||
if (
|
||||
$this->query()
|
||||
->whereIn($this->primaryKey(), $ids)
|
||||
->whereHas('workflow', fn ($query) => $query->whereIn('check_status', [CheckStatus::Processing, CheckStatus::Success]))
|
||||
->exists()
|
||||
) {
|
||||
admin_abort('选中记录中包含审核中或审核通过的记录');
|
||||
}
|
||||
}
|
||||
|
||||
public function sortColumn()
|
||||
{
|
||||
return 'id';
|
||||
|
|
|
|||
Loading…
Reference in New Issue