fix: rating-history API - pass auth token, fix table/column names
- frontend: pass token to listRatingHistory API call - backend: fix SQL table name redeem_logs -> redeem_records - backend: fix SQL column name title -> task_code in daily_task_logs Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
这个提交包含在:
@@ -247,13 +247,13 @@ SolutionAccessService::ListRatingHistory(int64_t user_id, int limit) {
|
|||||||
"' || problem_id) as note "
|
"' || problem_id) as note "
|
||||||
"FROM problem_solution_view_logs WHERE user_id=? AND cost > 0 "
|
"FROM problem_solution_view_logs WHERE user_id=? AND cost > 0 "
|
||||||
"UNION ALL "
|
"UNION ALL "
|
||||||
"SELECT 'daily_task' as type, created_at, reward as change, title as "
|
"SELECT 'daily_task' as type, created_at, reward as change, task_code as "
|
||||||
"note "
|
"note "
|
||||||
"FROM daily_task_logs WHERE user_id=? "
|
"FROM daily_task_logs WHERE user_id=? "
|
||||||
"UNION ALL "
|
"UNION ALL "
|
||||||
"SELECT 'redeem' as type, created_at, -total_cost as change, item_name "
|
"SELECT 'redeem' as type, created_at, -total_cost as change, item_name "
|
||||||
"as note "
|
"as note "
|
||||||
"FROM redeem_logs WHERE user_id=? "
|
"FROM redeem_records WHERE user_id=? "
|
||||||
"ORDER BY created_at DESC LIMIT ?";
|
"ORDER BY created_at DESC LIMIT ?";
|
||||||
|
|
||||||
CheckSqlite(sqlite3_prepare_v2(db, sql, -1, &stmt, nullptr), db,
|
CheckSqlite(sqlite3_prepare_v2(db, sql, -1, &stmt, nullptr), db,
|
||||||
|
|||||||
@@ -149,7 +149,7 @@ export default function MePage() {
|
|||||||
apiFetch<RedeemItem[]>("/api/v1/me/redeem/items", {}, tk),
|
apiFetch<RedeemItem[]>("/api/v1/me/redeem/items", {}, tk),
|
||||||
apiFetch<RedeemRecord[]>("/api/v1/me/redeem/records?limit=200", {}, tk),
|
apiFetch<RedeemRecord[]>("/api/v1/me/redeem/records?limit=200", {}, tk),
|
||||||
apiFetch<DailyTaskPayload>("/api/v1/me/daily-tasks", {}, tk),
|
apiFetch<DailyTaskPayload>("/api/v1/me/daily-tasks", {}, tk),
|
||||||
listRatingHistory(50),
|
listRatingHistory(50, tk),
|
||||||
]);
|
]);
|
||||||
setProfile(me);
|
setProfile(me);
|
||||||
setItems(redeemItems ?? []);
|
setItems(redeemItems ?? []);
|
||||||
|
|||||||
@@ -98,6 +98,6 @@ export interface RatingHistoryItem {
|
|||||||
note: string;
|
note: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function listRatingHistory(limit: number = 100): Promise<RatingHistoryItem[]> {
|
export async function listRatingHistory(limit: number = 100, token?: string): Promise<RatingHistoryItem[]> {
|
||||||
return apiFetch<RatingHistoryItem[]>(`/api/v1/me/rating-history?limit=${limit}`);
|
return apiFetch<RatingHistoryItem[]>(`/api/v1/me/rating-history?limit=${limit}`, {}, token);
|
||||||
}
|
}
|
||||||
|
|||||||
在新工单中引用
屏蔽一个用户