This commit is contained in:
root 2019-12-12 20:33:14 +08:00
parent 77a98adbc8
commit b26c5be030
2 changed files with 24 additions and 0 deletions

View File

@ -65,4 +65,27 @@ class TicketController extends Controller
'data' => true
]);
}
public function reply (Request $request) {
if (empty($request->input('id')) || empty($request->input('message'))) {
abort(500, '参数错误');
}
$ticket = Ticket::where('id', $request->input('id'))
->where('user_id', $request->session()->get('id'))
->first();
if (!$ticket) {
abort(500, '工单不存在');
}
$ticketMessage = TicketMessage::create([
'user_id' => $request->session()->get('id'),
'ticket_id' => $ticket->id,
'message' => $request->input('message')
]);
if (!$ticketMessage) {
abort(500, '工单回复失败');
}
return response([
'data' => true
]);
}
}

View File

@ -83,6 +83,7 @@ Route::prefix('v1')
// Ticket
Route::get ('ticket', 'TicketController@index');
Route::post('ticket/save', 'TicketController@save');
Route::post('ticket/reply', 'TicketController@reply');
});
// Passport