fix: 修复支付可能存在的缺陷

This commit is contained in:
archer
2023-03-22 12:20:27 +08:00
parent 984baf60f0
commit 5ec303610c
12 changed files with 266 additions and 93 deletions

View File

@@ -4,7 +4,7 @@ import { ResLogin } from './response/user';
import { EmailTypeEnum } from '@/constants/common';
import { UserType, UserUpdateParams } from '@/types/user';
import type { PagingData, RequestPaging } from '@/types';
import { BillSchema } from '@/types/mongoSchema';
import { BillSchema, PaySchema } from '@/types/mongoSchema';
import { adaptBill } from '@/utils/adapt';
export const sendCodeToEmail = ({ email, type }: { email: string; type: `${EmailTypeEnum}` }) =>
@@ -56,11 +56,12 @@ export const getUserBills = (data: RequestPaging) =>
data: res.data.map((bill) => adaptBill(bill))
}));
export const getPayOrders = () => GET<PaySchema[]>(`/user/getPayOrders`);
export const getPayCode = (amount: number) =>
GET<{
codeUrl: string;
orderId: string;
payId: string;
}>(`/user/getPayCode?amount=${amount}`);
export const checkPayResult = (orderId: string) =>
GET<number>(`/user/checkPayResult?orderId=${orderId}`);
export const checkPayResult = (payId: string) => GET<number>(`/user/checkPayResult?payId=${payId}`);