Merge branch 'feature/yuandan' into dev

This commit is contained in:
dy 2023-12-27 16:41:54 +08:00
commit 95a3e9d3fb
4 changed files with 10 additions and 34 deletions

View File

@ -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('1', 1, {'1': _hd.data.game});
await PlayerFun.sendPrize(call, prize);
}
await G.mongodb.cEvent(`yuandan${_hd.hdid}`).updateOne({uid: call.uid, type: `yuandan${_hd.hdid}`}, {

View File

@ -2,7 +2,7 @@
*
*/
export type ReqDMRec = {
prize: { a: string, t: string, n: number } | null
id: 1 | 0
}
export type ResDMRec = {}

View File

@ -11403,44 +11403,22 @@ 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"
}
}
]
"type": "Literal",
"literal": 1
}
},
{
"id": 1,
"type": {
"type": "Literal",
"literal": null
"literal": 0
}
}
]

View File

@ -73,6 +73,7 @@ export class PublicShared {
*
* @param id id
* @param num
* @param conf
*/
static randomDropGroup(id: string | number, num = 1, conf = G.gc.diaoluo): prizeType[] {
let prize = [];