diff --git a/app/Http/Controllers/Admin/ConfigController.php b/app/Http/Controllers/Admin/ConfigController.php index 013bbb5a..a2c0f053 100755 --- a/app/Http/Controllers/Admin/ConfigController.php +++ b/app/Http/Controllers/Admin/ConfigController.php @@ -11,6 +11,7 @@ class ConfigController extends Controller { public function fetch() { + // TODO: default should be in Dict return response([ 'data' => [ 'invite' => [ @@ -24,6 +25,7 @@ class ConfigController extends Controller 'stop_register' => (int)config('v2board.stop_register', 0), 'email_verify' => (int)config('v2board.email_verify', 0), 'app_name' => config('v2board.app_name', 'V2Board'), + 'app_description' => config('v2board.app_description', 'V2Board is best!'), 'app_url' => config('v2board.app_url'), 'subscribe_url' => config('v2board.subscribe_url'), 'plan_change_enable' => (int)config('v2board.plan_change_enable', 1), diff --git a/app/Http/Controllers/Admin/UserController.php b/app/Http/Controllers/Admin/UserController.php index 114f4634..5a036f07 100644 --- a/app/Http/Controllers/Admin/UserController.php +++ b/app/Http/Controllers/Admin/UserController.php @@ -15,14 +15,12 @@ class UserController extends Controller { $current = $request->input('current') ? $request->input('current') : 1; $pageSize = $request->input('pageSize') >= 10 ? $request->input('pageSize') : 10; - $sortType = $request->input('sort_type') ? 'ASC' : 'DESC'; - $userModel = User::orderBy('created_at', 'DESC'); + $sortType = in_array($request->input('sort_type'), ['ASC', 'DESC']) ? $request->input('sort_type') : 'DESC'; + $sort = $request->input('sort') ? $request->input('sort') : 'created_at'; + $userModel = User::orderBy($sort, $sortType); if ($request->input('email')) { $userModel->where('email', $request->input('email')); } - if ($request->input('sort')) { - $userModel->orderBy($request->input('sort'), $sortType); - } $total = $userModel->count(); $res = $userModel->forPage($current, $pageSize) ->get(); diff --git a/app/Http/Requests/Admin/ConfigSave.php b/app/Http/Requests/Admin/ConfigSave.php index c24cfcd2..9f8c40e0 100755 --- a/app/Http/Requests/Admin/ConfigSave.php +++ b/app/Http/Requests/Admin/ConfigSave.php @@ -15,6 +15,7 @@ class ConfigSave extends FormRequest 'stop_register' => 'in:0,1', 'email_verify' => 'in:0,1', 'app_name' => '', + 'app_description' => '', 'app_url' => 'url', 'subscribe_url' => 'url', 'plan_transfer_hour' => 'numeric',