dev #1

Merged
Ggy_shinidie merged 14 commits from dev into main 2026-08-14 13:44:59 +08:00
2 changed files with 8 additions and 3 deletions
Showing only changes of commit b8cd7e7658 - Show all commits

View File

@@ -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());
} }
} }

View File

@@ -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);
}
} }
// 当前无相同网站 // 当前无相同网站