mirror of
https://github.com/v2board/v2board.git
synced 2024-11-10 17:49:11 +08:00
fix user sorter
This commit is contained in:
parent
5db26d862b
commit
cb8cdb2e0e
@ -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),
|
||||
|
@ -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();
|
||||
|
@ -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',
|
||||
|
Loading…
Reference in New Issue
Block a user