fix: correct know file issues

This commit is contained in:
xboard 2025-01-09 01:38:53 +08:00
parent f9048e791f
commit 9369fcec3f
6 changed files with 24 additions and 32 deletions

View File

@ -69,8 +69,6 @@ class StatController extends Controller
'start_date' => 'nullable|date_format:Y-m-d', 'start_date' => 'nullable|date_format:Y-m-d',
'end_date' => 'nullable|date_format:Y-m-d', 'end_date' => 'nullable|date_format:Y-m-d',
'type' => 'nullable|in:paid_total,paid_count,commission_total,commission_count', 'type' => 'nullable|in:paid_total,paid_count,commission_total,commission_count',
'page' => 'nullable|integer|min:1',
'page_size' => 'nullable|integer|min:1|max:100'
]); ]);
$query = Stat::where('record_type', 'd'); $query = Stat::where('record_type', 'd');
@ -83,15 +81,7 @@ class StatController extends Controller
$query->where('record_at', '<=', strtotime($request->input('end_date') . ' 23:59:59')); $query->where('record_at', '<=', strtotime($request->input('end_date') . ' 23:59:59'));
} }
// Get total count for pagination
$total = $query->count();
// Apply pagination
$pageSize = $request->input('page_size', 31);
$page = $request->input('page', 1);
$statistics = $query->orderBy('record_at', 'DESC') $statistics = $query->orderBy('record_at', 'DESC')
->forPage($page, $pageSize)
->get() ->get()
->toArray(); ->toArray();
@ -157,12 +147,6 @@ class StatController extends Controller
'data' => [ 'data' => [
'list' => array_reverse($dailyStats), 'list' => array_reverse($dailyStats),
'summary' => $summary, 'summary' => $summary,
'pagination' => [
'total' => $total,
'current_page' => $page,
'page_size' => $pageSize,
'total_pages' => ceil($total / $pageSize)
]
] ]
]; ];
} }

View File

@ -70,7 +70,9 @@ class UserController extends Controller
$this->applyFiltersAndSorts($request, $userModel); $this->applyFiltersAndSorts($request, $userModel);
$users = $userModel->orderBy('id', 'desc')->paginate($pageSize, ['*'], 'page', $current); $users = $userModel->orderBy('id', 'desc')->paginate($pageSize, ['*'], 'page', $current);
$users->getCollection()->transform(function ($user) { $users->getCollection()->transform(function ($user) {
$user->subscribe_url = Helper::getSubscribeUrl( $user->token); $user->subscribe_url = Helper::getSubscribeUrl($user->token);
$user->balance = $user->balance / 100;
$user->commission_balance = $user->commission_balance / 100;
return $user; return $user;
}); });
return response([ return response([
@ -127,7 +129,13 @@ class UserController extends Controller
if (isset($params['banned']) && (int) $params['banned'] === 1) { if (isset($params['banned']) && (int) $params['banned'] === 1) {
$authService = new AuthService($user); $authService = new AuthService($user);
$authService->removeAllSession(); $authService->removeSession();
}
if (isset($params['balance'])) {
$params['balance'] = $params['balance'] * 100;
}
if (isset($params['commission_balance'])) {
$params['commission_balance'] = $params['commission_balance'] * 100;
} }
try { try {

View File

@ -42,7 +42,7 @@ class AuthService
return $this->user->tokens()->get()->toArray(); return $this->user->tokens()->get()->toArray();
} }
public function removeSession(string $sessionId): bool public function removeSession(): bool
{ {
$this->user->tokens()->delete(); $this->user->tokens()->delete();
return true; return true;

View File

@ -129,7 +129,7 @@ class ThemeService
*/ */
public function delete(string $theme): bool public function delete(string $theme): bool
{ {
if ($theme === admin_setting('current_theme')) { if ($theme === admin_setting('current_theme') || in_array($theme, ['Xboard', 'v2board'])) {
throw new Exception('Cannot delete active theme'); throw new Exception('Cannot delete active theme');
} }

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long