272 lines
7.4 KiB
JavaScript
272 lines
7.4 KiB
JavaScript
import { get, post } from '../utils/http.js'
|
|
// 获取可提现金额
|
|
export const withdrawableAmount = async (activityId) => {
|
|
try {
|
|
const response = await get(`/activity/lottery/withdraw/amount?activityId=${activityId}`)
|
|
return response
|
|
} catch (error) {
|
|
console.error('Failed to fetch get my withdrawable amount:', error)
|
|
console.error('error:' + error.response.errorMsg)
|
|
throw error
|
|
}
|
|
}
|
|
|
|
// 查询提现记录
|
|
export const withdrawRecords = async () => {
|
|
try {
|
|
const response = await get(`/activity/lottery/withdraw/records`)
|
|
return response
|
|
} catch (error) {
|
|
console.error('Failed to fetch get my withdraw records:', error)
|
|
console.error('error:' + error.response.errorMsg)
|
|
throw error
|
|
}
|
|
}
|
|
|
|
// 提交提现申请
|
|
export const withdrawApply = async (data) => {
|
|
try {
|
|
const response = await post('/activity/lottery/withdraw/apply', data)
|
|
return response
|
|
} catch (error) {
|
|
console.error('Failed to fetch withdraw apply:', error)
|
|
throw error
|
|
}
|
|
}
|
|
|
|
// 获取排行榜
|
|
export const ranklist = async (data) => {
|
|
try {
|
|
const response = await get(
|
|
`/activity/lottery/recharge-rank?activityId=${data.activityId}&pageNo=${data.pageNo}&pageSize=${data.pageSize}`,
|
|
)
|
|
return response
|
|
} catch (error) {
|
|
console.error('Failed to fetch get rank list:', error)
|
|
console.error('error:' + error.response.errorMsg)
|
|
throw error
|
|
}
|
|
}
|
|
|
|
// 获取有效活动
|
|
export const validActivity = async () => {
|
|
try {
|
|
const response = await get(`/activity/lottery/valid-activity`)
|
|
return response
|
|
} catch (error) {
|
|
console.error('Failed to fetch get valid activity:', error)
|
|
console.error('error:' + error.response.errorMsg)
|
|
throw error
|
|
}
|
|
}
|
|
|
|
// 获取活动详情
|
|
export const activityDetail = async (activityCode) => {
|
|
try {
|
|
const response = await get(`/activity/lottery/detail/${activityCode}`)
|
|
return response
|
|
} catch (error) {
|
|
console.error('Failed to fetch get activity detail:', error)
|
|
console.error('error:' + error.response.errorMsg)
|
|
throw error
|
|
}
|
|
}
|
|
|
|
// 获取充值记录
|
|
export const myRecharge = async (activityId) => {
|
|
try {
|
|
const response = await get(`/activity/lottery/my-recharge?activityId=${activityId}`)
|
|
return response
|
|
} catch (error) {
|
|
console.error('Failed to fetch get my recharge:', error)
|
|
console.error('error:' + error.response.errorMsg)
|
|
throw error
|
|
}
|
|
}
|
|
|
|
// 获取活动奖励配置列表.
|
|
export const activityRewardConfigs = async (data) => {
|
|
try {
|
|
const response = await get(
|
|
`/activity/lottery/reward-configs?activityType=${data.activityType}&activityId=${data.activityId}`,
|
|
)
|
|
return response
|
|
} catch (error) {
|
|
console.error('Failed to fetch get activity reward:', error)
|
|
console.error('error:' + error.response.errorMsg)
|
|
throw error
|
|
}
|
|
}
|
|
|
|
// 获取礼物排行榜奖励列表.
|
|
export const apiGiftsRankingRewardConfigs = async (data) => {
|
|
try {
|
|
const response = await get(
|
|
`/props-activity-cnf/client/listActivityResource?sysOrigin=LIKEI&activityType=LUCKY_GIFT_REWARD`,
|
|
)
|
|
return response
|
|
} catch (error) {
|
|
console.error('Failed to fetch get gifts ranking reward:', error)
|
|
console.error('error:' + error.response.errorMsg)
|
|
throw error
|
|
}
|
|
}
|
|
|
|
// 获取剩余中奖券
|
|
export const myTickets = async (activityId) => {
|
|
try {
|
|
if (!activityId) {
|
|
const response = await get(`/activity/lottery/my-ticket-count`)
|
|
return response
|
|
} else {
|
|
const response = await get(`/activity/lottery/my-ticket-count?activityId=${activityId}`)
|
|
return response
|
|
}
|
|
} catch (error) {
|
|
console.error('Failed to fetch get my tickets:', error)
|
|
console.error('error:' + error.response.errorMsg)
|
|
throw error
|
|
}
|
|
}
|
|
|
|
// 获取我的总抽奖次数
|
|
export const myTotalDrawCount = async () => {
|
|
try {
|
|
const response = await get(`/activity/lottery/my-total-draw-count`)
|
|
return response
|
|
} catch (error) {
|
|
console.error('Failed to fetch get my total draw count:', error)
|
|
console.error('error:' + error.response.errorMsg)
|
|
throw error
|
|
}
|
|
}
|
|
|
|
// 执行单次抽奖
|
|
export const onceDraw = async (data) => {
|
|
try {
|
|
const response = await post('/activity/lottery/draw', data)
|
|
return response
|
|
} catch (error) {
|
|
console.error('Failed to fetch once draw:', error)
|
|
throw error
|
|
}
|
|
}
|
|
|
|
// 执行连抽
|
|
export const multiDraw = async (data) => {
|
|
try {
|
|
const response = await post('/activity/lottery/multi-draw', data)
|
|
return response
|
|
} catch (error) {
|
|
console.error('Failed to fetch multiply draw:', error)
|
|
throw error
|
|
}
|
|
}
|
|
|
|
// 获取我的中奖记录(默认最新100条)
|
|
export const drawRecords = async (activityCode) => {
|
|
try {
|
|
const response = await get(
|
|
`/activity/lottery/my-records?pageSize=100&activityCode=${activityCode}`,
|
|
)
|
|
return response
|
|
} catch (error) {
|
|
console.error('Failed to fetch get draw records:', error)
|
|
console.error('error:' + error.response.errorMsg)
|
|
throw error
|
|
}
|
|
}
|
|
|
|
// 获取历史中奖用户
|
|
export const winnerHistory = async (activityId) => {
|
|
try {
|
|
const response = await get(`/activity/lottery/winner-history?activityId=${activityId}`)
|
|
return response
|
|
} catch (error) {
|
|
console.error('Failed to fetch get winners:', error)
|
|
console.error('error:' + error.response.errorMsg)
|
|
throw error
|
|
}
|
|
}
|
|
|
|
// 获取累计抽奖-徽章信息
|
|
export const rewardConfigsBadge = async (data) => {
|
|
try {
|
|
const response = await get(
|
|
`/activity/lottery/reward-configs-badge?activityType=${data.activityType}&activityId=${data.activityId}`,
|
|
)
|
|
return response
|
|
} catch (error) {
|
|
console.error('Failed to fetch get reward configs badge:', error)
|
|
console.error('error:' + error.response.errorMsg)
|
|
throw error
|
|
}
|
|
}
|
|
|
|
// 领取累计抽奖奖励-徽章
|
|
export const receiveRewardBadge = async (data) => {
|
|
try {
|
|
const response = await post('/activity/lottery/claim-reward-badge', data)
|
|
return response
|
|
} catch (error) {
|
|
console.error('Failed to fetch receive reward badge:', error)
|
|
throw error
|
|
}
|
|
}
|
|
|
|
// 获取任务列表
|
|
export const ActTaskList = async () => {
|
|
try {
|
|
const response = await get(`/spins/task/list`)
|
|
return response
|
|
} catch (error) {
|
|
console.error('Failed to fetch get tickets:', error)
|
|
console.error('error:' + error.response.errorMsg)
|
|
throw error
|
|
}
|
|
}
|
|
|
|
// 领取任务奖励
|
|
export const receiveTickets = async (data) => {
|
|
try {
|
|
const response = await post('/spins/task/receive/reward', data)
|
|
return response
|
|
} catch (error) {
|
|
console.error('Failed to fetch receive tickets:', error)
|
|
throw error
|
|
}
|
|
}
|
|
|
|
// 领取充值奖励
|
|
export const receiveRechargeReward = async (data) => {
|
|
try {
|
|
const response = await post('/activity/lottery/claim-reward', data)
|
|
return response
|
|
} catch (error) {
|
|
console.error('Failed to fetch receive rewards:', error)
|
|
throw error
|
|
}
|
|
}
|
|
|
|
// 可提现金额转账给指定用户
|
|
export const transferActivityDollar = async (data) => {
|
|
try {
|
|
const response = await post('/activity/lottery/transfer', data)
|
|
return response
|
|
} catch (error) {
|
|
console.error('Failed to fetch transfer activity dollar:', error)
|
|
throw error
|
|
}
|
|
}
|
|
|
|
// 可提现金额兑换金币
|
|
export const exchangeCoin = async (data) => {
|
|
try {
|
|
const response = await post('/activity/lottery/exchange', data)
|
|
return response
|
|
} catch (error) {
|
|
console.error('Failed to fetch exchange coin:', error)
|
|
throw error
|
|
}
|
|
}
|