feat: add tags to plans, refactor order service, adn fix ticket lock

This commit is contained in:
xboard
2025-07-01 11:14:18 +08:00
parent 349c1710fe
commit 05afe870e7
13 changed files with 208 additions and 97 deletions

View File

@@ -43,8 +43,9 @@ class TicketController extends Controller
{
try{
DB::beginTransaction();
if ((int)Ticket::where('status', 0)->where('user_id', $request->user()->id)->lockForUpdate()->count()) {
throw new \Exception(__('There are other unresolved tickets'));
if (Ticket::where('status', 0)->where('user_id', $request->user()->id)->lockForUpdate()->first()) {
DB::rollBack();
return $this->fail([400, '存在未关闭的工单']);
}
$ticket = Ticket::create(array_merge($request->only([
'subject',