| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 |
- import { get, post, postL } from './http';
- const apis = {
- PRE_ONE_KEY: '/api/substituteOrder/preOneKeySubmit',
- COUPON: '/api/coupon/pageMyValidCoupon',
- BILL: '/api/wallet/bill',
-
- WITHDRAW_PRE: '/api/wallet/withdrawPre',
- WITHDRAW: '/api/wallet/withdraw',
- WITHDRAW_INFO: '/api/user/withdraw/info', // Bank info
- WITHDRAW_SAVE: '/api/user/withdraw/save',
- RECHARGE_GENERATE_LINK: '/api/user/recharge/generatePaymentLink',
- RECHARGE_CHECK_PAYMENT_STATUS: '/api/user/recharge/checkPaymentStatus',
-
- INFO: '/api/wallet/getByType',
-
- NEW_USER_PROMOTION: '/api/activity/newUserPromotion',
- };
- export const preOneKeySubmit = async () => {
- const res = await post(apis.PRE_ONE_KEY);
- return res;
- };
- export const info = async (type: string, loading = false) => {
- // loading handled manually if needed, or pass header
- const res = await get(apis.INFO, { type }, { loading });
- return res.data;
- };
- export const bill = async (current: number, size: number, walletType: string, type: string) => {
- const res = await post(apis.BILL, { current, size, walletType, type });
- return res.data;
- };
- export const withdrawPre = async (type: string, walletType: string) => {
- const res = await get(apis.WITHDRAW_PRE, { type, walletType });
- return res.data;
- };
- export const getWithdraw = async () => {
- const res = await get(apis.WITHDRAW_INFO);
- return res.data;
- };
- export const saveWithdraw = async (data: any) => {
- const res = await post(apis.WITHDRAW_SAVE, data);
- return res.success;
- };
- export const withdraw = async (data: any) => {
- const res = await postL(apis.WITHDRAW, data);
- return res.success;
- };
- export const generatePaymentLink = async (amount: number, payType: string, walletType: string) => {
- const res = await postL(apis.RECHARGE_GENERATE_LINK, { amount, payType, walletType });
- return res;
- };
- export const checkPaymentStatus = async (data: { tradeNo: string }) => {
- const res = await post(apis.RECHARGE_CHECK_PAYMENT_STATUS, data);
- return res;
- };
- export const getNewUserPromotion = async () => {
- const res = await get(apis.NEW_USER_PROMOTION);
- return res.data;
- };
- export default {
- preOneKeySubmit,
- info,
- bill,
- withdrawPre,
- getWithdraw,
- saveWithdraw,
- withdraw,
- generatePaymentLink,
- checkPaymentStatus,
- getNewUserPromotion,
- coupons: async (size = 30) => {
- const res = await post(apis.COUPON, { size }, { loading: true });
- return res.data;
- },
- };
|