import request from '@/utils/request';

// 获取用户邀请码
export const getUserInfo = (data: any) => {
  return request.get('/api/user/info', {
    params: data,
  });
};

// 获取进行中的列表
export const getBlindBoxList = (address: string = '') => {
  return request.get('/api/BlindBoxList', {
    params: {
      address: address ? address : undefined,
    },
  });
};

// 购买前判断用户能否购买盲盒
export const useCanNotBuy = (data: any) => {
  return request.get('/api/CanNotBuy', {
    params: data,
  });
};

// 购买盲盒
export const buy_blindBox = (data: any) => {
  return request.post('/api/BlindBox/buy', {
    ...data,
  });
};

// 轮询检测是否购买成功
export const IntervalCheckOrder = (data: any) => {
  return request.post('/api/BlindBox/buy/check', {
    ...data,
  });
};

// 用户订单
export const UserOrder = (data: any) => {
  return request.get('/api/order', {
    params: data,
  });
};

// 获取收款地址
export const getReceiptAddress = () => {
  return request.get('/api/address');
};
