增加额度查询

This commit is contained in:
2025-08-08 13:19:06 +08:00
parent 5016c1d9d6
commit 8f633d97d4
5 changed files with 309 additions and 233 deletions

View File

@@ -577,6 +577,20 @@ export interface NodeSpeedTestResult {
error?: string; // 错误信息
}
/** PackyCode 用户额度信息 */
export interface PackycodeUserQuota {
daily_budget_usd: number; // 日预算(美元)
daily_spent_usd: number; // 日已使用(美元)
monthly_budget_usd: number; // 月预算(美元)
monthly_spent_usd: number; // 月已使用(美元)
balance_usd: number; // 账户余额(美元)
total_spent_usd: number; // 总消费(美元)
plan_type: string; // 计划类型 (pro, basic, etc.)
plan_expires_at: string; // 计划过期时间
username?: string; // 用户名
email?: string; // 邮箱
}
/**
* API client for interacting with the Rust backend
*/
@@ -2372,5 +2386,19 @@ export const api = {
console.error("Failed to get PackyCode nodes:", error);
throw error;
}
},
/**
* Gets PackyCode user quota information
* @param stationId - The relay station ID
* @returns Promise resolving to the user quota information
*/
async getPackycodeUserQuota(stationId: string): Promise<PackycodeUserQuota> {
try {
return await invoke<PackycodeUserQuota>("packycode_get_user_quota", { stationId });
} catch (error) {
console.error("Failed to get PackyCode user quota:", error);
throw error;
}
}
};