mirror of
https://github.com/cedar2025/Xboard.git
synced 2025-01-22 18:48:14 -05:00
Compare commits
2 Commits
f9048e791f
...
d5c24ed3d1
Author | SHA1 | Date | |
---|---|---|---|
|
d5c24ed3d1 | ||
|
9369fcec3f |
@ -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)
|
||||
]
|
||||
]
|
||||
];
|
||||
}
|
||||
|
@ -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 {
|
||||
|
@ -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;
|
||||
|
@ -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');
|
||||
}
|
||||
|
||||
|
2
public/assets/admin/assets/index.css
vendored
2
public/assets/admin/assets/index.css
vendored
File diff suppressed because one or more lines are too long
16
public/assets/admin/assets/index.js
vendored
16
public/assets/admin/assets/index.js
vendored
File diff suppressed because one or more lines are too long
8
public/assets/admin/assets/vendor.js
vendored
8
public/assets/admin/assets/vendor.js
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user