aslan-h5/src/api/activity.js

113 lines
3.3 KiB
JavaScript

import { get, post } from '../utils/http.js'
// 获取排行榜和我的排名
export const getRankingListAndMyRanking = async (data) => {
try {
const response = await post(`/ranking/list`, data)
return response
} catch (error) {
console.error('Failed to get list and my ranking:', error)
console.error('error:' + error.response.errorMsg)
throw error
}
}
// 获取本周奖励和礼物
export const getThisWeekRewardsAndGifts = async (templateId) => {
try {
const response = await get(`/activity/king-queen/effective?templateId=${templateId}`)
return response
} catch (error) {
console.error('Failed to get this week rewards and gifts:', error)
console.error('error:' + error.response.errorMsg)
throw error
}
}
// 获取总榜前三
export const getOverallRankingTop3 = async (data) => {
try {
const response = await post(`/ranking/top-three-overall`, data)
return response
} catch (error) {
console.error('Failed to get history top one:', error)
console.error('error:' + error.response.errorMsg)
throw error
}
}
// 获取总榜
export const getOverallRanking = async (topN, data) => {
try {
const response = await post(`/ranking/top-three-overall?topN=${topN}`, data)
return response
} catch (error) {
console.error('Failed to get history top one:', error)
console.error('error:' + error.response.errorMsg)
throw error
}
}
// 获取历史榜首
export const getHistoryTopOne = async (activityType) => {
try {
let data = { activityType }
const response = await post(`/ranking/historical-top1`, data)
return response
} catch (error) {
console.error('Failed to get history top one:', error)
console.error('error:' + error.response.errorMsg)
throw error
}
}
// 获取指定类型活动资源
export const apiGetActivityResource = async (activityType) => {
try {
const response = await get(
`/props-activity-cnf/client/listActivityResource?sysOrigin=LIKEI&activityType=${activityType}`,
)
return response
} catch (error) {
console.error('Failed to get activity resource:', error)
console.error('error:' + error.response.errorMsg)
throw error
}
}
// 获取每日充值活动等级任务信息
export const getDailyRechargeInfo = async () => {
try {
const response = await get('/activity/daily-recharge/info')
return response
} catch (error) {
console.error('Failed to get daily recharge info:', error)
console.error('error:' + error.response.errorMsg)
throw error
}
}
// 领取每日充值活动 task1 历史累计奖励
export const claimDailyRechargeTask1 = async () => {
try {
const response = await post('/activity/daily-recharge/claim/task1')
return response
} catch (error) {
console.error('Failed to claim daily recharge task1 reward:', error)
console.error('error:' + error.response.errorMsg)
throw error
}
}
// 领取每日充值活动 task2 当前等级奖励
export const claimDailyRechargeTask2 = async (data) => {
try {
const response = await post('/activity/daily-recharge/claim/task2', data)
return response
} catch (error) {
console.error('Failed to claim daily recharge task2 reward:', error)
console.error('error:' + error.response.errorMsg)
throw error
}
}