93 lines
2.3 KiB
Plaintext
93 lines
2.3 KiB
Plaintext
import { RequestResponse } from "@/types/interfaces/request";
|
|
import {
|
|
MySubscriptionData,
|
|
CreditSummaryInfo,
|
|
CreditPackageInfo,
|
|
CreditBatchItem,
|
|
SystemSubscriptionPlan,
|
|
CashierInfo,
|
|
CreditRecordInfo,
|
|
} from "@/subpackages/types/interfaces/subscription";
|
|
import request from "@/servers/useRequest";
|
|
|
|
export async function apiGetMySubscription(params: Record<string, string>) {
|
|
return request<RequestResponse<MySubscriptionData>>({
|
|
url: "/api/subscription/my",
|
|
method: "GET",
|
|
data: params,
|
|
});
|
|
}
|
|
|
|
export async function apiGetCreditSummary() {
|
|
return request<RequestResponse<CreditSummaryInfo>>({
|
|
url: "/api/credit/summary",
|
|
method: "GET",
|
|
});
|
|
}
|
|
|
|
export async function apiListSystemSubscriptionPlans() {
|
|
return request<RequestResponse<SystemSubscriptionPlan[]>>({
|
|
url: "/api/subscription/system/plans",
|
|
method: "GET",
|
|
});
|
|
}
|
|
|
|
export async function apiListCreditPackages() {
|
|
return request<RequestResponse<CreditPackageInfo[]>>({
|
|
url: "/api/credit/package/list",
|
|
method: "GET",
|
|
});
|
|
}
|
|
|
|
export async function apiCreateCreditOrder(packageId: number) {
|
|
return request<RequestResponse<any>>({
|
|
url: `/api/credit/order/create?packageId=${packageId}`,
|
|
method: "POST",
|
|
});
|
|
}
|
|
|
|
export async function apiGetCreditBatches(params: Record<string, string>) {
|
|
return request<RequestResponse<CreditBatchItem[]>>({
|
|
url: "/api/credit/batches",
|
|
method: "GET",
|
|
data: params,
|
|
});
|
|
}
|
|
|
|
export async function apiCreateSubscriptionOrder(planId: number) {
|
|
return request<RequestResponse<any>>({
|
|
url: `/api/subscription/order/create?planId=${planId}`,
|
|
method: "POST",
|
|
});
|
|
}
|
|
|
|
export async function apiGetOrderCashier(orderId: number, returnUrl?: string) {
|
|
const data: Record<string, any> = { orderId };
|
|
if (returnUrl != null) {
|
|
data["returnUrl"] = returnUrl;
|
|
}
|
|
return request<RequestResponse<CashierInfo>>({
|
|
url: "/api/bill/order/pay/cashier",
|
|
method: "GET",
|
|
data,
|
|
});
|
|
}
|
|
|
|
export async function apiGetCreditFlows(params: Record<string, any>) {
|
|
return request<RequestResponse<CreditRecordInfo[]>>({
|
|
url: "/api/credit/flows",
|
|
method: "GET",
|
|
data: params,
|
|
});
|
|
}
|
|
|
|
export async function apiGetAgentSubscriptionPlanList(
|
|
params: Record<string, any>,
|
|
) {
|
|
return request<RequestResponse<SystemSubscriptionPlan[]>>({
|
|
url: "/api/agent/plan/list",
|
|
method: "GET",
|
|
data: params,
|
|
});
|
|
}
|