feat(data): add paywall payment APIs

This commit is contained in:
2026-06-18 12:53:06 +08:00
parent 567d3f9184
commit 35c30ac31e
38 changed files with 840 additions and 10 deletions
@@ -16,6 +16,7 @@ import type {
ChatHistoryResponse,
ChatMessage,
ChatSendResponse,
UnlockPrivateResponse,
} from "@/data/dto/chat";
export interface IChatRepository {
@@ -28,6 +29,9 @@ export interface IChatRepository {
/** 获取聊天历史,分页参数默认 limit=50, offset=0。 */
getHistory(limit?: number, offset?: number): Promise<Result<ChatHistoryResponse>>;
/** 解锁私密消息。 */
unlockPrivateMessage(messageId: string): Promise<Result<UnlockPrivateResponse>>;
/** 把一条消息写入本地存储。 */
saveMessageToLocal(message: ChatMessage): Promise<Result<void>>;
@@ -5,4 +5,5 @@
export * from "./iauth_repository";
export * from "./ichat_repository";
export * from "./imetrics_repository";
export * from "./ipayment_repository";
export * from "./iuser_repository";
@@ -0,0 +1,31 @@
"use client";
/**
* IPaymentRepository 接口
*/
import type {
CreatePaymentOrderResponse,
PayChannel,
PaymentOrderStatusResponse,
PaymentPlansResponse,
PaymentVipStatusResponse,
} from "@/data/dto/payment";
import type { Result } from "@/utils/result";
export interface IPaymentRepository {
/** 获取套餐列表。 */
getPlans(): Promise<Result<PaymentPlansResponse>>;
/** 创建支付订单。 */
createOrder(
planId: string,
payChannel: PayChannel,
autoRenew: boolean,
): Promise<Result<CreatePaymentOrderResponse>>;
/** 查询支付订单状态。 */
getOrderStatus(orderId: string): Promise<Result<PaymentOrderStatusResponse>>;
/** 查询当前用户 VIP 状态。 */
getVipStatus(): Promise<Result<PaymentVipStatusResponse>>;
}