改进 错误处理

This commit is contained in:
iVampireSP.com 2022-12-11 09:53:37 +08:00
parent 8f85d28a10
commit e6fc281ec1
No known key found for this signature in database
GPG Key ID: 2F7B001CA27A8132

View File

@ -76,6 +76,10 @@ protected static function boot()
// load work order
$model->load(['workOrder']);
// throw if work order is null
if (is_null($model->workOrder)) {
throw new CommonException('Work order not found');
}
throw_if($model->workOrder->status == 'pending' || $model->workOrder->status == 'error', CommonException::class, '工单状态不正确');
// change work order status