娃娃机改为掉落组
This commit is contained in:
parent
d4bd776b48
commit
0df09e0f9e
@ -3,17 +3,13 @@ import {ReqDMRec, ResDMRec} from "../../../shared/protocols/event/yuandan/PtlDMR
|
||||
import {HuoDongFun} from "../../../public/huodongfun";
|
||||
import {PlayerFun} from "../../../public/player";
|
||||
import {HongDianChange} from "../../hongdian/fun";
|
||||
import {PublicShared} from "../../../shared/public/public";
|
||||
|
||||
export default async function (call: ApiCall<ReqDMRec, ResDMRec>) {
|
||||
// 查询活动是否存在
|
||||
let _hd = (await HuoDongFun.gethdList(call, 14))[0]
|
||||
if (!_hd) return call.errorCode(-1)
|
||||
|
||||
// 奖励不符合
|
||||
let toPrize = call.req.prize
|
||||
let prize = _hd.data.game.find(i => i.a == toPrize?.a && i.t == toPrize?.t && i.n == toPrize?.n)
|
||||
if (toPrize && !prize) return call.errorCode(-4)
|
||||
|
||||
// 扣除免费次数或相应货币
|
||||
let data = await G.mongodb.cEvent(`yuandan${_hd.hdid}`).findOne({uid: call.uid, type: `yuandan${_hd.hdid}`})
|
||||
let rec = data?.gameNum
|
||||
@ -23,8 +19,9 @@ export default async function (call: ApiCall<ReqDMRec, ResDMRec>) {
|
||||
await PlayerFun.cutNeed(call, _hd.data.gameneed);
|
||||
}
|
||||
|
||||
if (prize) {
|
||||
await PlayerFun.sendPrize(call, [prize]);
|
||||
if (call.req.id) {
|
||||
let prize = PublicShared.randomDropGroup(call.req.id, 1, _hd.data.game);
|
||||
await PlayerFun.sendPrize(call, prize);
|
||||
}
|
||||
|
||||
await G.mongodb.cEvent(`yuandan${_hd.hdid}`).updateOne({uid: call.uid, type: `yuandan${_hd.hdid}`}, {
|
||||
|
@ -2,7 +2,7 @@
|
||||
* 元旦达摩领奖
|
||||
*/
|
||||
export type ReqDMRec = {
|
||||
prize: { a: string, t: string, n: number } | null
|
||||
id: string | null
|
||||
}
|
||||
|
||||
export type ResDMRec = {}
|
||||
|
@ -11403,39 +11403,16 @@ export const serviceProto: ServiceProto<ServiceType> = {
|
||||
"properties": [
|
||||
{
|
||||
"id": 0,
|
||||
"name": "prize",
|
||||
"name": "id",
|
||||
"type": {
|
||||
"type": "Union",
|
||||
"members": [
|
||||
{
|
||||
"id": 0,
|
||||
"type": {
|
||||
"type": "Interface",
|
||||
"properties": [
|
||||
{
|
||||
"id": 0,
|
||||
"name": "a",
|
||||
"type": {
|
||||
"type": "String"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 1,
|
||||
"name": "t",
|
||||
"type": {
|
||||
"type": "String"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
"name": "n",
|
||||
"type": {
|
||||
"type": "Number"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 1,
|
||||
"type": {
|
||||
|
Loading…
Reference in New Issue
Block a user