88 lines
2.0 KiB
TypeScript
88 lines
2.0 KiB
TypeScript
import request from '@/utils/http'
|
||
|
||
/**
|
||
* 大富翁-玩家 API接口
|
||
*/
|
||
export default {
|
||
/**
|
||
* 获取数据列表
|
||
* @param params 搜索参数
|
||
* @returns 数据列表
|
||
*/
|
||
list(params: Record<string, any>) {
|
||
return request.get<Api.Common.ApiPage>({
|
||
url: '/dice/player/DicePlayer/index',
|
||
params
|
||
})
|
||
},
|
||
|
||
/**
|
||
* 读取数据
|
||
* @param id 数据ID
|
||
* @returns 数据详情
|
||
*/
|
||
read(id: number | string) {
|
||
return request.get<Api.Common.ApiData>({
|
||
url: '/dice/player/DicePlayer/read?id=' + id
|
||
})
|
||
},
|
||
|
||
/**
|
||
* 创建数据
|
||
* @param params 数据参数
|
||
* @returns 执行结果
|
||
*/
|
||
save(params: Record<string, any>) {
|
||
return request.post<any>({
|
||
url: '/dice/player/DicePlayer/save',
|
||
data: params
|
||
})
|
||
},
|
||
|
||
/**
|
||
* 更新数据
|
||
* @param params 数据参数
|
||
* @returns 执行结果
|
||
*/
|
||
update(params: Record<string, any>) {
|
||
return request.put<any>({
|
||
url: '/dice/player/DicePlayer/update',
|
||
data: params
|
||
})
|
||
},
|
||
|
||
/**
|
||
* 删除数据
|
||
* @param id 数据ID
|
||
* @returns 执行结果
|
||
*/
|
||
delete(params: Record<string, any>) {
|
||
return request.del<any>({
|
||
url: '/dice/player/DicePlayer/destroy',
|
||
data: params
|
||
})
|
||
},
|
||
|
||
/**
|
||
* 仅更新状态(列表内开关用)
|
||
*/
|
||
updateStatus(params: { id: number | string; status: number }) {
|
||
return request.put<any>({
|
||
url: '/dice/player/DicePlayer/updateStatus',
|
||
data: params
|
||
})
|
||
},
|
||
|
||
/**
|
||
* 获取彩金池配置选项(DiceLotteryConfig.id、name),供 lottery_config_id 下拉使用
|
||
* @returns [ { id, name } ]
|
||
*/
|
||
async getLotteryConfigOptions(): Promise<Array<{ id: number; name: string }>> {
|
||
const res = await request.get<any>({
|
||
url: '/dice/player/DicePlayer/getLotteryConfigOptions'
|
||
})
|
||
const rows = (Array.isArray(res) ? res : (res?.data ?? [])) as Array<{ id: number; name: string }>
|
||
return rows.map((r) => ({ id: Number(r.id), name: String(r.name ?? r.id ?? '') }))
|
||
}
|
||
}
|