改进 工单删除
This commit is contained in:
parent
2d466026ab
commit
7e76bb574b
@ -47,17 +47,17 @@ public function handle(): void
|
|||||||
|
|
||||||
if ($this->type == 'post') {
|
if ($this->type == 'post') {
|
||||||
$response = $this->workOrder->module->http()->post('work-orders', $this->workOrder->toArray());
|
$response = $this->workOrder->module->http()->post('work-orders', $this->workOrder->toArray());
|
||||||
} elseif ($this->type == 'put') {
|
} else if ($this->type == 'put') {
|
||||||
$response = $this->workOrder->module->http()->put('work-orders/'.$this->workOrder->id, $this->workOrder->toArray());
|
$response = $this->workOrder->module->http()->put('work-orders/' . $this->workOrder->id, $this->workOrder->toArray());
|
||||||
} else {
|
} else {
|
||||||
$response = $this->workOrder->module->http()->delete('work-orders/'.$this->workOrder->id);
|
$response = $this->workOrder->module->http()->delete('work-orders/' . $this->workOrder->id);
|
||||||
|
|
||||||
if ($response->successful()) {
|
if ($response->successful()) {
|
||||||
$this->workOrder->delete();
|
$this->workOrder->delete();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $response->successful()) {
|
if (!$response->successful()) {
|
||||||
Log::debug('WorkOrder push failed', [
|
Log::debug('WorkOrder push failed', [
|
||||||
'type' => $this->type,
|
'type' => $this->type,
|
||||||
'response' => $response->json(),
|
'response' => $response->json(),
|
||||||
|
@ -150,8 +150,11 @@ public function safeDelete(): bool
|
|||||||
throw new CommonException('工单状态是 pending,无法删除');
|
throw new CommonException('工单状态是 pending,无法删除');
|
||||||
}
|
}
|
||||||
|
|
||||||
dispatch(new WorkOrderJob($this, 'delete'));
|
if ($this->isPlatform()) {
|
||||||
|
$this->delete();
|
||||||
|
} else {
|
||||||
|
dispatch(new WorkOrderJob($this, 'delete'));
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user