Compare commits

...

2 Commits

Author SHA1 Message Date
xboard
d5c24ed3d1 fix: correct know file issues
Some checks are pending
Docker Build and Publish / build (push) Waiting to run
2025-01-09 02:06:32 +08:00
xboard
9369fcec3f fix: correct know file issues 2025-01-09 01:38:53 +08:00
7 changed files with 28 additions and 37 deletions

View File

@ -69,8 +69,6 @@ class StatController extends Controller
'start_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',
'page' => 'nullable|integer|min:1',
'page_size' => 'nullable|integer|min:1|max:100'
]);
$query = Stat::where('record_type', 'd');
@ -83,25 +81,16 @@ class StatController extends Controller
$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')
->forPage($page, $pageSize)
->get()
->toArray();
->get();
$summary = [
'paid_total' => 0,
'paid_count' => 0,
'commission_total' => 0,
'commission_count' => 0,
'start_date' => $request->input('start_date', date('Y-m-d', strtotime('-30 days'))),
'end_date' => $request->input('end_date', date('Y-m-d')),
'start_date' => $request->input('start_date', date('Y-m-d', $statistics->last()->record_at)),
'end_date' => $request->input('end_date', date('Y-m-d', $statistics->first()->record_at)),
'avg_paid_amount' => 0,
'avg_commission_amount' => 0
];
@ -157,12 +146,6 @@ class StatController extends Controller
'data' => [
'list' => array_reverse($dailyStats),
'summary' => $summary,
'pagination' => [
'total' => $total,
'current_page' => $page,
'page_size' => $pageSize,
'total_pages' => ceil($total / $pageSize)
]
]
];
}

View File

@ -71,6 +71,8 @@ class UserController extends Controller
$users = $userModel->orderBy('id', 'desc')->paginate($pageSize, ['*'], 'page', $current);
$users->getCollection()->transform(function ($user) {
$user->subscribe_url = Helper::getSubscribeUrl($user->token);
$user->balance = $user->balance / 100;
$user->commission_balance = $user->commission_balance / 100;
return $user;
});
return response([
@ -127,7 +129,13 @@ class UserController extends Controller
if (isset($params['banned']) && (int) $params['banned'] === 1) {
$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 {

View File

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

View File

@ -129,7 +129,7 @@ class ThemeService
*/
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');
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long