update: admin replyed reopen ticket

This commit is contained in:
tokumeikoi 2022-01-22 01:52:02 +08:00
parent 36f87bd61f
commit 6f849664cc
2 changed files with 2 additions and 4 deletions

View File

@ -184,6 +184,7 @@ class TelegramController extends Controller
abort(500, '用户不存在'); abort(500, '用户不存在');
} }
$ticketService = new TicketService(); $ticketService = new TicketService();
if (!$msg->text) return;
if ($user->is_admin || $user->is_staff) { if ($user->is_admin || $user->is_staff) {
$ticketService->replyByAdmin( $ticketService->replyByAdmin(
$ticketId, $ticketId,

View File

@ -12,15 +12,12 @@ use Illuminate\Support\Facades\DB;
class TicketService { class TicketService {
public function replyByAdmin($ticketId, $message, $userId):void public function replyByAdmin($ticketId, $message, $userId):void
{ {
if ($message)
$ticket = Ticket::where('id', $ticketId) $ticket = Ticket::where('id', $ticketId)
->first(); ->first();
if (!$ticket) { if (!$ticket) {
abort(500, '工单不存在'); abort(500, '工单不存在');
} }
if ($ticket->status) { $ticket->status = 0;
abort(500, '工单已关闭,无法回复');
}
DB::beginTransaction(); DB::beginTransaction();
$ticketMessage = TicketMessage::create([ $ticketMessage = TicketMessage::create([
'user_id' => $userId, 'user_id' => $userId,