Files
dafuweng-saiadmin6.x/saiadmin-artd/src/views/plugin/dice/api/reward/index.ts
2026-03-27 14:14:59 +08:00

101 lines
2.8 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import request from '@/utils/http'
/**
* 奖励对照dice_rewardAPI
*/
export default {
/**
* 分页列表,按 direction 区分顺时针(0)/逆时针(1)
* @param params direction(必), tier(选), page, limit, orderField, orderType
*/
list(params: Record<string, any>) {
return request.get<Api.Common.ApiPage>({
url: '/core/dice/reward/DiceReward/index',
params
})
},
/**
* 权重编辑弹窗:按档位分组获取当前方向的配置+权重(单方向)
* @param direction 0=顺时针 1=逆时针
*/
weightRatioList(direction: 0 | 1) {
return request.get<Api.Common.ApiData>({
url: '/core/dice/reward/DiceReward/weightRatioList',
params: { direction }
})
},
/**
* 权重编辑弹窗:按档位分组获取配置+顺时针/逆时针权重dice_reward 双方向)
*/
weightRatioListWithDirection() {
return request.get<Api.Common.ApiData>({
url: '/core/dice/reward/DiceReward/weightRatioListWithDirection'
})
},
/**
* 权重编辑弹窗:按 DiceReward 主键 id 批量更新 weight
* @param items [{ id: DiceReward.id, weight: 1-10000 }, ...]
*/
batchUpdateWeights(items: Array<{ id: number; weight: number }>) {
return request.post<any>({
url: '/core/dice/reward/DiceReward/batchUpdateWeights',
data: { items }
})
},
/**
* 权重编辑弹窗:批量更新当前方向的权重(单方向)
*/
batchUpdateWeightsByDirection(direction: 0 | 1, items: Array<{ id: number; weight: number }>) {
return request.post<any>({
url: '/core/dice/reward/DiceReward/batchUpdateWeightsByDirection',
data: { direction, items }
})
},
/**
* 一键测试权重:创建测试记录并启动后台执行
* chain_free_mode=true仅模拟付费次数付费抽到再来一次则插入免费抽奖同底注、付费金额 0
*/
startWeightTest(params: {
ante?: number
lottery_config_id?: number
paid_lottery_config_id?: number
free_lottery_config_id?: number
chain_free_mode?: boolean
s_count?: number
n_count?: number
paid_s_count?: number
paid_n_count?: number
free_s_count?: number
free_n_count?: number
paid_tier_weights?: Record<string, number>
free_tier_weights?: Record<string, number>
}) {
return request.post<{ record_id: number }>({
url: '/core/dice/reward/DiceReward/startWeightTest',
data: params
})
},
/**
* 查询一键测试进度
*/
getTestProgress(recordId: number) {
return request.get<{
total_play_count: number
over_play_count: number
status: number
remark: string | null
result_counts: Record<number, number> | null
tier_counts: Record<string, number> | null
}>({
url: '/core/dice/reward/DiceReward/getTestProgress',
params: { record_id: recordId }
})
}
}