wip
This commit is contained in:
@@ -49,6 +49,9 @@ class Ticket extends BaseController
|
|||||||
$result = $ticketService->createTicket($data);
|
$result = $ticketService->createTicket($data);
|
||||||
return $this->success('创建成功', $result);
|
return $this->success('创建成功', $result);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
|
if ($e->getCode() === 409) {
|
||||||
|
return $this->error($e->getMessage(), ['confirm' => true], 409);
|
||||||
|
}
|
||||||
return $this->error($e->getMessage());
|
return $this->error($e->getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -61,8 +61,8 @@ class TicketService
|
|||||||
*/
|
*/
|
||||||
public function createTicket(array $data)
|
public function createTicket(array $data)
|
||||||
{
|
{
|
||||||
if (isset($data['website']) && $data['website'] === '') { // isset检查键存在且不为null
|
if (!isset($data['website']) || trim((string)$data['website'] === '')) { // isset检查键存在且不为null
|
||||||
throw new \Exception('网站不能为空');
|
throw new \Exception('网站输入不能为空');
|
||||||
}
|
}
|
||||||
|
|
||||||
$website = trim($data['website']);
|
$website = trim($data['website']);
|
||||||
@@ -72,7 +72,9 @@ class TicketService
|
|||||||
->find();
|
->find();
|
||||||
|
|
||||||
if ($unfinishedTicket) {
|
if ($unfinishedTicket) {
|
||||||
throw new \Exception('已存在未完成的同网站工单,无法创建');
|
if (empty($data['confirm'])) {
|
||||||
|
throw new \Exception('已存在未分配或进行中的相同工单,是否继续创建?', 409);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 当前无相同网站
|
// 当前无相同网站
|
||||||
|
|||||||
Reference in New Issue
Block a user