mirror of
https://github.com/v2board/v2board.git
synced 2024-11-10 09:39:10 +08:00
update
This commit is contained in:
parent
a7d39a70b1
commit
e7b15a168b
@ -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
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
@ -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')
|
||||
|
@ -118,6 +118,7 @@ CREATE TABLE `v2_ticket` (
|
||||
`last_reply_user_id` int(11) NOT NULL,
|
||||
`subject` varchar(255) NOT NULL,
|
||||
`level` tinyint(1) NOT NULL,
|
||||
`status` tinyint(1) NOT NULL DEFAULT '0' COMMENT '0:已开启 1:已关闭',
|
||||
`created_at` int(11) NOT NULL,
|
||||
`updated_at` int(11) NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
@ -170,4 +171,4 @@ CREATE TABLE `v2_user` (
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
|
||||
-- 2019-12-13 09:09:07
|
||||
-- 2019-12-13 09:26:39
|
@ -52,6 +52,7 @@ Route::prefix('v1')
|
||||
// Ticket
|
||||
Route::get ('ticket', 'Admin\\TicketController@index');
|
||||
Route::post('ticket/reply', 'Admin\\TicketController@reply');
|
||||
Route::post('ticket/close', 'Admin\\TicketController@close');
|
||||
});
|
||||
// User
|
||||
Route::prefix('user')
|
||||
@ -87,6 +88,7 @@ Route::prefix('v1')
|
||||
Route::get ('ticket', 'TicketController@index');
|
||||
Route::post('ticket/save', 'TicketController@save');
|
||||
Route::post('ticket/reply', 'TicketController@reply');
|
||||
Route::post('ticket/close', 'TicketController@close');
|
||||
});
|
||||
|
||||
// Passport
|
||||
|
@ -49,4 +49,7 @@ CREATE TABLE `v2_ticket_message` (
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
ALTER TABLE `v2_ticket`
|
||||
ADD `last_reply_user_id` int(11) NOT NULL AFTER `user_id`;
|
||||
ADD `last_reply_user_id` int(11) NOT NULL AFTER `user_id`;
|
||||
|
||||
ALTER TABLE `v2_ticket`
|
||||
ADD `status` tinyint(1) NOT NULL DEFAULT '0' COMMENT '0:已开启 1:已关闭' AFTER `level`;
|
Loading…
Reference in New Issue
Block a user