diff --git a/app/Http/Controllers/Admin/TicketController.php b/app/Http/Controllers/Admin/TicketController.php index 3724a3a3..aff4bd77 100644 --- a/app/Http/Controllers/Admin/TicketController.php +++ b/app/Http/Controllers/Admin/TicketController.php @@ -30,17 +30,22 @@ class TicketController extends Controller 'data' => $ticket ]); } - $ticket = Ticket::orderBy('created_at', 'DESC') + $current = $request->input('current') ? $request->input('current') : 1; + $pageSize = $request->input('pageSize') >= 10 ? $request->input('pageSize') : 10; + $model = Ticket::orderBy('created_at', 'DESC'); + $total = $model->count(); + $res = $model->forPage($current, $pageSize) ->get(); - for ($i = 0; $i < count($ticket); $i++) { - if ($ticket[$i]['last_reply_user_id'] == $request->session()->get('id')) { - $ticket[$i]['reply_status'] = 0; + for ($i = 0; $i < count($res); $i++) { + if ($res[$i]['last_reply_user_id'] == $request->session()->get('id')) { + $res[$i]['reply_status'] = 0; } else { - $ticket[$i]['reply_status'] = 1; + $res[$i]['reply_status'] = 1; } } return response([ - 'data' => $ticket + 'data' => $res, + 'total' => $total ]); } diff --git a/database/install.sql b/database/install.sql index 5a6648f8..f728268f 100644 --- a/database/install.sql +++ b/database/install.sql @@ -1,4 +1,4 @@ --- Adminer 4.7.6 MySQL dump +-- Adminer 4.7.3 MySQL dump SET NAMES utf8; SET time_zone = '+00:00'; @@ -108,11 +108,12 @@ CREATE TABLE `v2_plan` ( `sort` int(11) DEFAULT NULL, `renew` tinyint(1) NOT NULL DEFAULT '1', `content` text, - `month_price` int(11) DEFAULT '0', - `quarter_price` int(11) DEFAULT '0', - `half_year_price` int(11) DEFAULT '0', - `year_price` int(11) DEFAULT '0', + `month_price` int(11) DEFAULT NULL, + `quarter_price` int(11) DEFAULT NULL, + `half_year_price` int(11) DEFAULT NULL, + `year_price` int(11) DEFAULT NULL, `onetime_price` int(11) DEFAULT NULL, + `reset_price` int(11) DEFAULT NULL, `created_at` int(11) NOT NULL, `updated_at` int(11) NOT NULL, PRIMARY KEY (`id`) @@ -158,13 +159,15 @@ CREATE TABLE `v2_server_group` ( DROP TABLE IF EXISTS `v2_server_log`; CREATE TABLE `v2_server_log` ( + `id` bigint(20) NOT NULL AUTO_INCREMENT, `user_id` int(11) NOT NULL, `server_id` int(11) NOT NULL, `u` varchar(255) NOT NULL, `d` varchar(255) NOT NULL, `rate` decimal(10,2) NOT NULL, `created_at` int(11) NOT NULL, - `updated_at` int(11) NOT NULL + `updated_at` int(11) NOT NULL, + PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; @@ -177,7 +180,7 @@ CREATE TABLE `v2_server_stat` ( `created_at` int(11) NOT NULL, `updated_at` int(11) NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; +) ENGINE=InnoDB DEFAULT CHARSET=utf8; DROP TABLE IF EXISTS `v2_ticket`; @@ -219,11 +222,6 @@ CREATE TABLE `v2_tutorial` ( PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -INSERT INTO `v2_tutorial` (`id`, `category_id`, `title`, `steps`, `show`, `sort`, `created_at`, `updated_at`) VALUES -(1, 1, 'V2rayN', '[{\"default_area\":\"
{{$app_name}}
{{$subscribe_url}}
{{$app_name}}
{{$subscribe_url}}
{{$subscribe_url}}
{{$app_name}}
{{$apple_id}}
点击复制密码