feat(user): sync entitlement snapshot

This commit is contained in:
2026-06-29 10:37:37 +08:00
parent 455204e1e4
commit 58cd2a7545
22 changed files with 479 additions and 54 deletions
+3
View File
@@ -69,6 +69,9 @@ export class ApiPath {
/** 查询积分操作历史 */
static readonly userCreditsHistory = `${ApiPath._user}/credits/history`;
/** 获取当前用户权益快照 */
static readonly userEntitlements = `${ApiPath._user}/entitlements`;
// ============ 支付相关 ============
/** 创建充值订单 */
static readonly paymentCreateOrder = `${ApiPath._payment}/create-order`;
+9
View File
@@ -12,6 +12,7 @@ import {
CreditsHistoryData,
UpdateProfileRequest,
User,
UserEntitlements,
UserStatsResponse,
} from "@/data/dto/user";
import type { UserData } from "@/data/schemas/user/user";
@@ -69,6 +70,14 @@ export class UserApi {
unwrap(env) as Record<string, unknown>
);
}
/**
* 获取当前用户权益快照
*/
async getEntitlements(): Promise<UserEntitlements> {
const env = await httpClient<ApiEnvelope<unknown>>(ApiPath.userEntitlements);
return UserEntitlements.fromJson(unwrap(env) as Record<string, unknown>);
}
}
/**