This commit is contained in:
root
2019-12-13 17:29:55 +08:00
parent a7d39a70b1
commit e7b15a168b
5 changed files with 46 additions and 2 deletions

View File

@ -75,4 +75,22 @@ class TicketController extends Controller
'data' => true
]);
}
public function close (Request $request) {
if (empty($request->input('id'))) {
abort(500, '参数错误');
}
$ticket = Ticket::where('id', $request->input('id'))
->first();
if (!$ticket) {
abort(500, '工单不存在');
}
$ticket->status = 1;
if (!$ticket->save()) {
abort(500, '关闭失败');
}
return response([
'data' => true
]);
}
}

View File

@ -108,6 +108,26 @@ class TicketController extends Controller
]);
}
public function close (Request $request) {
if (empty($request->input('id'))) {
abort(500, '参数错误');
}
$ticket = Ticket::where('id', $request->input('id'))
->where('user_id', $request->session()->get('id'))
->first();
if (!$ticket) {
abort(500, '工单不存在');
}
$ticket->status = 1;
if (!$ticket->save()) {
abort(500, '关闭失败');
}
return response([
'data' => true
]);
}
private function getLastMessage ($ticketId) {
return TicketMessage::where('ticket_id', $ticketId)
->orderBy('id', 'DESC')