import { mergeStep } from '@/utils'
import { http } from '@/utils/http'

// 注册用户
export const registerUserAPI = (data) =>
  http({
    url: '/api/user/register',
    method: 'POST',
    data,
  })

// 登录
export const loginUserAPI = (data) =>
  http({
    url: '/api/user/login',
    method: 'POST',
    data,
  })

// 获取用户信息
export const getUserInfoAPI = () =>
  http({
    url: '/api/user/index',
    method: 'GET',
  })

// 退出登录
export const logoutUserAPI = () =>
  http({
    url: '/api/user/logout',
    method: 'POST',
  })

// 简介、公告、新闻
export const getIntroductionAPI = (data) =>
  http({
    url: '/api/index/articlelist',
    method: 'POST',
    data,
  })

// 新闻详情
export const getIntroductionDetailAPI = (data) =>
  http({
    url: '/api/index/articledetails',
    method: 'POST',
    data,
  })

// 投资理财列表
export const getInvestmentListAPI = (data) =>
  http({
    url: '/api/index/investlist',
    method: 'POST',
    data,
  })

// 提交投资
export const submitInvestAPI = (data) =>
  http({
    url: '/api/user/submitinvest',
    method: 'POST',
    data,
  })

// 获取投资记录
export const getInvestmentRecordAPI = (data) =>
  http({
    url: '/api/user/myinvestlist',
    method: 'POST',
    data,
  })

// 查询实名认证
export const getRealNameAuthAPI = mergeStep(() =>
  http({
    url: '/api/user/finduserauth',
    method: 'POST',
  }),
)

// 实名认证
export const realNameAuthAPI = (data) =>
  http({
    url: '/api/user/userauth',
    method: 'POST',
    data,
  })

// 我的邀请
export const getMyTeamAPI = (data) =>
  http({
    url: '/api/user/inviteelist',
    method: 'POST',
    data,
  })

// 我的资产
export const getMyAssetAPI = (data) =>
  http({
    url: '/api/user/moneyloglist',
    method: 'POST',
    data,
  })

// 股数转换
export const convertScoreAPI = (data) =>
  http({
    url: '/api/user/conversion',
    method: 'POST',
    data,
  })

// 添加银行卡
export const addBankCardAPI = (data) =>
  http({
    url: '/api/user/addbank',
    method: 'POST',
    data,
  })

// 获取银行卡
export const getBankCardAPI = (data) =>
  http({
    url: '/api/user/banklist',
    method: 'POST',
    data,
  })

// 删除银行卡
export const deleteBankCardAPI = (data) =>
  http({
    url: '/api/user/delbank',
    method: 'POST',
    data,
  })

// 提交提现
export const submitWithdrawalAPI = (data) =>
  http({
    url: '/api/user/withdrawal',
    method: 'POST',
    data,
  })

// 获取提现记录
export const getWithdrawalRecordAPI = (data) =>
  http({
    url: '/api/user/withdrawallist',
    method: 'POST',
    data,
  })

// 下载APP
export const downloadAppAPI = () => {
  location.href = 'https://r2.maldiveswallet.vip/app/yjyh.apk'
}

// 社区我的邀请
export const getCommunityMyInviteAPI = (data) =>
  http({
    url: '/api/user/inviteelist',
    method: 'POST',
    data,
  })

// 领取奖励第一步
export const getCommunityInviteFirstAPI = () =>
  http({
    url: '/api/user/rewardone',
    method: 'POST',
  })

// 领取救济金
export const getCommunityInviteRewardAPI = (data) =>
  http({
    url: '/api/user/rewardtwo',
    method: 'POST',
    data,
  })

// 签到功能
export const getSignInAPI = () =>
  http({
    url: '/api/user/signin',
    method: 'POST',
  })

// 开通个人养老账户
export const getOpenPersonalAccountAPI = () =>
  http({
    url: '/api/user/activateold',
    method: 'POST',
  })

// 养老金转入余额
export const getOldMoneyTransferAPI = (data) =>
  http({
    url: '/api/user/yangout',
    method: 'POST',
    data,
  })

// 佣金转入养老金
export const getYongMoneyTransferAPI = (data) =>
  http({
    url: '/api/user/tuanduiout',
    method: 'POST',
    data,
  })
// 轮播图
export const getBannerAPI = () =>
  http({
    url: '/api/index/bannerlist',
    method: 'POST',
  })

// 银行卡资产恢复列表
export const getBankCardRecoverListAPI = () =>
  http({
    url: '/api/user/bankassetslist',
    method: 'POST',
  })

// 银行卡资产恢复
export const getBankCardRecoverAPI = (data) =>
  http({
    url: '/api/user/userbankassets',
    method: 'POST',
    data,
  })
