修复 仪表盘一直转圈ug

This commit is contained in:
yml2213
2026-05-27 01:23:57 +08:00
parent 6fe3c75674
commit a04327fd05
5 changed files with 10 additions and 5 deletions
@@ -79,7 +79,7 @@ func (r *Repository) Summary() (*DashboardDTO, error) {
} }
func (r *Repository) recentOrders() ([]RecentOrderDTO, error) { func (r *Repository) recentOrders() ([]RecentOrderDTO, error) {
var rows []RecentOrderDTO rows := make([]RecentOrderDTO, 0)
err := r.db.Table("rental_orders AS o"). err := r.db.Table("rental_orders AS o").
Select("o.id, o.order_no, a.title, o.renter_id, o.owner_id, o.status, o.rent_amount, o.deposit_amount, o.created_at"). Select("o.id, o.order_no, a.title, o.renter_id, o.owner_id, o.status, o.rent_amount, o.deposit_amount, o.created_at").
Joins("JOIN game_accounts AS a ON a.id = o.account_id"). Joins("JOIN game_accounts AS a ON a.id = o.account_id").
@@ -90,7 +90,7 @@ func (r *Repository) recentOrders() ([]RecentOrderDTO, error) {
} }
func (r *Repository) recentDisputes() ([]RecentDisputeDTO, error) { func (r *Repository) recentDisputes() ([]RecentDisputeDTO, error) {
var rows []RecentDisputeDTO rows := make([]RecentDisputeDTO, 0)
err := r.db.Table("disputes AS d"). err := r.db.Table("disputes AS d").
Select("d.id, d.order_id, o.order_no, a.title, d.type, d.status, d.initiator_id, d.created_at"). Select("d.id, d.order_id, o.order_no, a.title, d.type, d.status, d.initiator_id, d.created_at").
Joins("JOIN rental_orders AS o ON o.id = d.order_id"). Joins("JOIN rental_orders AS o ON o.id = d.order_id").
+1 -1
View File
@@ -60,7 +60,7 @@ export async function logoutAdmin() {
export async function refreshAdminSession() { export async function refreshAdminSession() {
const refreshToken = getRefreshToken('admin') const refreshToken = getRefreshToken('admin')
if (!refreshToken) throw new Error('no refresh token') if (!refreshToken) throw new Error('no refresh token')
const { data } = await axios.post<ApiResponse<AdminTokenPair>>('/api/admin/auth/refresh', { refresh_token: refreshToken }) const { data } = await axios.post<ApiResponse<AdminTokenPair>>('/api/admin/auth/refresh', { refresh_token: refreshToken }, { timeout: 10000 })
setAuthTokens('admin', data.data) setAuthTokens('admin', data.data)
return data.data return data.data
} }
+5 -1
View File
@@ -53,5 +53,9 @@ export interface AdminDashboard {
export async function fetchAdminDashboard() { export async function fetchAdminDashboard() {
const { data } = await apiClient.get<ApiResponse<AdminDashboard>>('/admin/dashboard') const { data } = await apiClient.get<ApiResponse<AdminDashboard>>('/admin/dashboard')
return data.data return {
...data.data,
recent_orders: data.data.recent_orders ?? [],
recent_disputes: data.data.recent_disputes ?? [],
}
} }
+1 -1
View File
@@ -78,7 +78,7 @@ async function refreshToken(scope: AuthScope): Promise<string> {
if (!refreshToken) throw new Error('no refresh token') if (!refreshToken) throw new Error('no refresh token')
const endpoint = scope === 'admin' ? '/api/admin/auth/refresh' : '/api/auth/refresh' const endpoint = scope === 'admin' ? '/api/admin/auth/refresh' : '/api/auth/refresh'
const { data } = await axios.post(endpoint, { refresh_token: refreshToken }) const { data } = await axios.post(endpoint, { refresh_token: refreshToken }, { timeout: 10000 })
const tokens = { const tokens = {
access_token: data.data.access_token, access_token: data.data.access_token,
refresh_token: data.data.refresh_token, refresh_token: data.data.refresh_token,
@@ -8,6 +8,7 @@ import {
Operation, Operation,
Refresh, Refresh,
ScaleToOriginal, ScaleToOriginal,
ShoppingBag,
Shop, Shop,
Tickets, Tickets,
User, User,