Compare commits

..

No commits in common. "428033b26fab22b18242ada1645959db7e2f9ced" and "7aaa0699f9448f0302fa1c7adf88fae3158b1318" have entirely different histories.

9 changed files with 12789 additions and 22024 deletions

View File

@ -3,7 +3,6 @@ import {HuoDongFun} from "../../../public/huodongfun";
import { PayFun } from '../../../public/pay'; import { PayFun } from '../../../public/pay';
import { ReqOpen, ResOpen } from "../../../shared/protocols/event/leijichongzhi/PtlOpen"; import { ReqOpen, ResOpen } from "../../../shared/protocols/event/leijichongzhi/PtlOpen";
import { PublicShared } from '../../../shared/public/public'; import { PublicShared } from '../../../shared/public/public';
import {checkNextRound} from "./ApiRec";
export default async function (call: ApiCall<ReqOpen, ResOpen>) { export default async function (call: ApiCall<ReqOpen, ResOpen>) {
let _hdinfo = await HuoDongFun.getHdidInfo(call, call.req.hdid) let _hdinfo = await HuoDongFun.getHdidInfo(call, call.req.hdid)
@ -17,22 +16,17 @@ export default async function (call: ApiCall<ReqOpen, ResOpen>) {
let sTime = db?.sTime || PublicShared.getToDayZeroTime(G.time); let sTime = db?.sTime || PublicShared.getToDayZeroTime(G.time);
if (!db) { if (!db) {
await G.mongodb.cEvent(_dbType).updateOne( G.mongodb.cEvent(_dbType).updateOne(
{ uid: call.uid, type: _dbType }, { uid: call.uid, type: _dbType },
{ $set: { sTime: sTime, recIndex: [] } }, { $set: { sTime: sTime, recIndex: [] } },
{ upsert: true } { upsert: true }
); );
} }
db = await checkNextRound(call, db, _hdinfo.data.tasks)
let payNum = (await PayFun.getPayDaysAllPayNum(call.uid, _hdinfo.stime, _hdinfo.rtime)) * 10
payNum = payNum - (db.round || 0) * R.sort((a, b) => b.total - a.total)(_hdinfo.data.tasks)[0].total
call.succ({ call.succ({
sTime: sTime, sTime: sTime,
recIndex: db?.recIndex || [], recIndex: db?.recIndex || [],
payNum: payNum, payNum: (await PayFun.getPayDaysAllPayNum(call.uid, _hdinfo.stime, _hdinfo.rtime)) * 10,
hdinfo: _hdinfo, hdinfo: _hdinfo
round: db.round || 0
}); });
} }

View File

@ -21,29 +21,17 @@ export default async function (call: ApiCall<ReqRec, ResRec>) {
if (db.recIndex.includes(call.req.index)) return call.error('', { code: -2 }); if (db.recIndex.includes(call.req.index)) return call.error('', { code: -2 });
let payNum = (await PayFun.getPayDaysAllPayNum(call.uid, _hdinfo.stime, _hdinfo.rtime)) * 10; let payNum = (await PayFun.getPayDaysAllPayNum(call.uid, _hdinfo.stime, _hdinfo.rtime)) * 10;
payNum = payNum - (db.round || 0) * R.sort((a, b) => b.total - a.total)(_hdinfo.data.tasks)[0].total
if (payNum < conf.total) return call.error('', { code: -3 }); if (payNum < conf.total) return call.error('', { code: -3 });
await PlayerFun.sendPrize(call, conf.prize); await PlayerFun.sendPrize(call, conf.prize);
await G.mongodb.cEvent(_dbType).updateOne( G.mongodb.cEvent(_dbType).updateOne(
{ uid: call.uid, type: _dbType }, { uid: call.uid, type: _dbType },
{ $push: { recIndex: call.req.index } } { $push: { recIndex: call.req.index } }
); );
await checkNextRound(call, db, _hdinfo.data.tasks)
HongDianChange.sendChangeKey(call.uid, ['huodonghd']) HongDianChange.sendChangeKey(call.uid, ['huodonghd'])
call.succ({ call.succ({
prize: conf.prize prize: conf.prize
}); });
} }
export async function checkNextRound(call: ApiCall, event, tasks) {
let _dbType: `leijichongzhi${number}` = `leijichongzhi${call.req.hdid}`
if ((event?.recIndex?.length || 0) < tasks.length) return event
return (await G.mongodb.cEvent(_dbType).findOneAndUpdate(
{uid: call.uid, type: _dbType},
{$set: {recIndex: []}, $inc: {round: 1}}, {returnDocument: 'after'}
)).value;
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -537,8 +537,8 @@
"mapId": 420, "mapId": 420,
"prize": [ "prize": [
{ {
"a": "attr", "a": "item",
"t": "rmbmoney", "t": "4",
"n": 100 "n": 100
} }
], ],
@ -550,8 +550,8 @@
"mapId": 430, "mapId": 430,
"prize": [ "prize": [
{ {
"a": "item", "a": "attr",
"t": "4", "t": "rmbmoney",
"n": 5 "n": 5
} }
], ],
@ -589,8 +589,8 @@
"mapId": 460, "mapId": 460,
"prize": [ "prize": [
{ {
"a": "attr", "a": "item",
"t": "rmbmoney", "t": "4",
"n": 100 "n": 100
} }
], ],
@ -615,8 +615,8 @@
"mapId": 480, "mapId": 480,
"prize": [ "prize": [
{ {
"a": "item", "a": "attr",
"t": "4", "t": "rmbmoney",
"n": 5 "n": 5
} }
], ],
@ -641,8 +641,8 @@
"mapId": 500, "mapId": 500,
"prize": [ "prize": [
{ {
"a": "attr", "a": "item",
"t": "rmbmoney", "t": "4",
"n": 100 "n": 100
} }
], ],
@ -680,8 +680,8 @@
"mapId": 530, "mapId": 530,
"prize": [ "prize": [
{ {
"a": "item", "a": "attr",
"t": "4", "t": "rmbmoney",
"n": 5 "n": 5
} }
], ],
@ -693,8 +693,8 @@
"mapId": 540, "mapId": 540,
"prize": [ "prize": [
{ {
"a": "attr", "a": "item",
"t": "rmbmoney", "t": "4",
"n": 100 "n": 100
} }
], ],
@ -797,8 +797,8 @@
"mapId": 620, "mapId": 620,
"prize": [ "prize": [
{ {
"a": "attr", "a": "item",
"t": "rmbmoney", "t": "4",
"n": 100 "n": 100
} }
], ],
@ -810,8 +810,8 @@
"mapId": 630, "mapId": 630,
"prize": [ "prize": [
{ {
"a": "item", "a": "attr",
"t": "4", "t": "rmbmoney",
"n": 5 "n": 5
} }
], ],
@ -849,8 +849,8 @@
"mapId": 660, "mapId": 660,
"prize": [ "prize": [
{ {
"a": "attr", "a": "item",
"t": "rmbmoney", "t": "4",
"n": 100 "n": 100
} }
], ],
@ -875,8 +875,8 @@
"mapId": 680, "mapId": 680,
"prize": [ "prize": [
{ {
"a": "item", "a": "attr",
"t": "4", "t": "rmbmoney",
"n": 5 "n": 5
} }
], ],
@ -901,8 +901,8 @@
"mapId": 700, "mapId": 700,
"prize": [ "prize": [
{ {
"a": "attr", "a": "item",
"t": "rmbmoney", "t": "4",
"n": 100 "n": 100
} }
], ],
@ -940,8 +940,8 @@
"mapId": 730, "mapId": 730,
"prize": [ "prize": [
{ {
"a": "item", "a": "attr",
"t": "4", "t": "rmbmoney",
"n": 5 "n": 5
} }
], ],
@ -953,8 +953,8 @@
"mapId": 740, "mapId": 740,
"prize": [ "prize": [
{ {
"a": "attr", "a": "item",
"t": "rmbmoney", "t": "4",
"n": 100 "n": 100
} }
], ],
@ -1057,8 +1057,8 @@
"mapId": 820, "mapId": 820,
"prize": [ "prize": [
{ {
"a": "attr", "a": "item",
"t": "rmbmoney", "t": "4",
"n": 100 "n": 100
} }
], ],
@ -1070,8 +1070,8 @@
"mapId": 830, "mapId": 830,
"prize": [ "prize": [
{ {
"a": "item", "a": "attr",
"t": "4", "t": "rmbmoney",
"n": 5 "n": 5
} }
], ],
@ -1109,8 +1109,8 @@
"mapId": 860, "mapId": 860,
"prize": [ "prize": [
{ {
"a": "attr", "a": "item",
"t": "rmbmoney", "t": "4",
"n": 100 "n": 100
} }
], ],
@ -1135,8 +1135,8 @@
"mapId": 880, "mapId": 880,
"prize": [ "prize": [
{ {
"a": "item", "a": "attr",
"t": "4", "t": "rmbmoney",
"n": 5 "n": 5
} }
], ],
@ -1161,8 +1161,8 @@
"mapId": 900, "mapId": 900,
"prize": [ "prize": [
{ {
"a": "attr", "a": "item",
"t": "rmbmoney", "t": "4",
"n": 100 "n": 100
} }
], ],
@ -1200,8 +1200,8 @@
"mapId": 930, "mapId": 930,
"prize": [ "prize": [
{ {
"a": "item", "a": "attr",
"t": "4", "t": "rmbmoney",
"n": 5 "n": 5
} }
], ],
@ -1213,8 +1213,8 @@
"mapId": 940, "mapId": 940,
"prize": [ "prize": [
{ {
"a": "attr", "a": "item",
"t": "rmbmoney", "t": "4",
"n": 100 "n": 100
} }
], ],
@ -1298,109 +1298,5 @@
], ],
"chapter": 14, "chapter": 14,
"des": "intr_guanqia_des_1" "des": "intr_guanqia_des_1"
},
"101": {
"id": 101,
"mapId": 1010,
"prize": [
{
"a": "attr",
"t": "rmbmoney",
"n": 100
}
],
"chapter": 14,
"des": "intr_guanqia_des_1"
},
"102": {
"id": 102,
"mapId": 1020,
"prize": [
{
"a": "attr",
"t": "rmbmoney",
"n": 100
}
],
"chapter": 14,
"des": "intr_guanqia_des_1"
},
"103": {
"id": 103,
"mapId": 1030,
"prize": [
{
"a": "item",
"t": "4",
"n": 5
}
],
"chapter": 14,
"des": "intr_guanqia_des_1"
},
"104": {
"id": 104,
"mapId": 1040,
"prize": [
{
"a": "attr",
"t": "rmbmoney",
"n": 100
}
],
"chapter": 14,
"des": "intr_guanqia_des_1"
},
"105": {
"id": 105,
"mapId": 1050,
"prize": [
{
"a": "attr",
"t": "rmbmoney",
"n": 100
}
],
"chapter": 14,
"des": "intr_guanqia_des_1"
},
"106": {
"id": 106,
"mapId": 1060,
"prize": [
{
"a": "attr",
"t": "rmbmoney",
"n": 100
}
],
"chapter": 14,
"des": "intr_guanqia_des_1"
},
"107": {
"id": 107,
"mapId": 1070,
"prize": [
{
"a": "attr",
"t": "rmbmoney",
"n": 100
}
],
"chapter": 14,
"des": "intr_guanqia_des_1"
},
"108": {
"id": 108,
"mapId": 1080,
"prize": [
{
"a": "item",
"t": "4",
"n": 5
}
],
"chapter": 14,
"des": "intr_guanqia_des_1"
} }
} }

File diff suppressed because it is too large Load Diff

View File

@ -16,6 +16,4 @@ export type ResOpen = {
payNum: number; payNum: number;
/**活动信息 */ /**活动信息 */
hdinfo: ReqAddHuoDong; hdinfo: ReqAddHuoDong;
/** 当前领取轮次 */
round: number
}; };

View File

@ -10263,13 +10263,6 @@ export const serviceProto: ServiceProto<ServiceType> = {
"type": "Reference", "type": "Reference",
"target": "../../monopoly/protocols/PtlAddHuoDong/ReqAddHuoDong" "target": "../../monopoly/protocols/PtlAddHuoDong/ReqAddHuoDong"
} }
},
{
"id": 4,
"name": "round",
"type": {
"type": "Number"
}
} }
] ]
}, },