状态修改校验(不能倒退状态)

This commit is contained in:
2025-07-04 16:10:16 +08:00
parent 92fd6d4d9f
commit bb1f105021
8 changed files with 9 additions and 9 deletions
+1 -1
View File
@@ -26,7 +26,7 @@ class TicketController extends BaseController
? $this->success() ? $this->success()
: $this->error(); : $this->error();
} catch (\Throwable $th) { } catch (\Throwable $th) {
return $this->error($th->getMessage().' '.$th->getLine().' '.$th->getFile()); return $this->error($th->getMessage());
} }
} }
+2 -2
View File
@@ -63,11 +63,11 @@ class AttachmentLogic
$res = Attachment::whereNotIn('id', $attachmentsId)->where('ticket_id',$ticket_id)->delete(); $res = Attachment::whereNotIn('id', $attachmentsId)->where('ticket_id',$ticket_id)->delete();
return $res; return $res;
} catch (\Throwable $e) { } catch (\Throwable $e) {
Log::error('工单创建失败', [ Log::error('工单编辑(附件)失败', [
'data' => $data, 'data' => $data,
'error' => $e->getMessage() 'error' => $e->getMessage()
]); ]);
throw new BusinessException('工单创建失败,请稍后重试', 500); throw new BusinessException('工单编辑失败,请稍后重试', 500);
} }
} }
+1 -1
View File
@@ -52,7 +52,7 @@ class TicketLogic
'data' => $data, 'data' => $data,
'error' => $e->getMessage() 'error' => $e->getMessage()
]); ]);
throw new BusinessException('工单提取方法…失败,请稍后重试', 500); throw new BusinessException('工单编辑失败,请稍后重试', 500);
} }
} }
+1 -1
View File
@@ -79,7 +79,7 @@ class TicketService
if(empty($ticket)){ if(empty($ticket)){
throw new BusinessException('工单不存在'); throw new BusinessException('工单不存在');
} }
if($data['status'] == $ticket->status){ if($data['status'] <= $ticket->status){
throw new BusinessException(trans('status_not_modified')); throw new BusinessException(trans('status_not_modified'));
} }
+1 -1
View File
@@ -1,5 +1,5 @@
<?php <?php
return [ return [
'status_not_modified' => 'الوضع لم يتغير', 'status_not_modified' => 'الدولة لا يمكن تعديلها عكسيا',
]; ];
+1 -1
View File
@@ -1,5 +1,5 @@
<?php <?php
return [ return [
'status_not_modified' => 'status not modified', 'status_not_modified' => 'The status cannot be reversed for modification',
]; ];
+1 -1
View File
@@ -1,5 +1,5 @@
<?php <?php
return [ return [
'status_not_modified' => 'Статус не изменен', 'status_not_modified' => 'Статус не может быть изменен в обратном направлении',
]; ];
+1 -1
View File
@@ -1,5 +1,5 @@
<?php <?php
return [ return [
'status_not_modified' => '状态未修改', 'status_not_modified' => '状态不能逆向修改',
]; ];