mirror of
https://github.com/v2board/v2board.git
synced 2024-11-10 09:39:10 +08:00
update
This commit is contained in:
parent
77a98adbc8
commit
b26c5be030
@ -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
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user