Compare commits

..

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

9 changed files with 12789 additions and 22024 deletions

View File

@ -1,38 +1,32 @@
import {ApiCall} from "tsrpc";
import {HuoDongFun} from "../../../public/huodongfun";
import {PayFun} from '../../../public/pay';
import {ReqOpen, ResOpen} from "../../../shared/protocols/event/leijichongzhi/PtlOpen";
import {PublicShared} from '../../../shared/public/public';
import {checkNextRound} from "./ApiRec";
import { ApiCall } from "tsrpc";
import { HuoDongFun } from "../../../public/huodongfun";
import { PayFun } from '../../../public/pay';
import { ReqOpen, ResOpen } from "../../../shared/protocols/event/leijichongzhi/PtlOpen";
import { PublicShared } from '../../../shared/public/public';
export default async function (call: ApiCall<ReqOpen, ResOpen>) {
let _hdinfo = await HuoDongFun.getHdidInfo(call, call.req.hdid)
if (!_hdinfo || Object.keys(_hdinfo).length <= 0) {
// 无此活动
return call.error('', {code: -1, message: globalThis.lng.huodong_open_1})
return call.error('', { code: -1, message: globalThis.lng.huodong_open_1 })
}
let _dbType: `leijichongzhi${number}` = `leijichongzhi${call.req.hdid}`
let db = await G.mongodb.cEvent(_dbType).findOne({uid: call.uid, type: _dbType});
let db = await G.mongodb.cEvent(_dbType).findOne({ uid: call.uid, type: _dbType });
let sTime = db?.sTime || PublicShared.getToDayZeroTime(G.time);
if (!db) {
await G.mongodb.cEvent(_dbType).updateOne(
{uid: call.uid, type: _dbType},
{$set: {sTime: sTime, recIndex: []}},
{upsert: true}
G.mongodb.cEvent(_dbType).updateOne(
{ uid: call.uid, type: _dbType },
{ $set: { sTime: sTime, recIndex: [] } },
{ 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({
sTime: sTime,
recIndex: db?.recIndex || [],
payNum: payNum,
hdinfo: _hdinfo,
round: db.round || 0
payNum: (await PayFun.getPayDaysAllPayNum(call.uid, _hdinfo.stime, _hdinfo.rtime)) * 10,
hdinfo: _hdinfo
});
}

View File

@ -1,49 +1,37 @@
import {ApiCall} from "tsrpc";
import {HuoDongFun} from "../../../public/huodongfun";
import {PayFun} from '../../../public/pay';
import {PlayerFun} from '../../../public/player';
import {ReqRec, ResRec} from "../../../shared/protocols/event/leijichongzhi/PtlRec";
import {HongDianChange} from "../../hongdian/fun";
import { ApiCall } from "tsrpc";
import { HuoDongFun } from "../../../public/huodongfun";
import { PayFun } from '../../../public/pay';
import { PlayerFun } from '../../../public/player';
import { ReqRec, ResRec } from "../../../shared/protocols/event/leijichongzhi/PtlRec";
import { HongDianChange } from "../../hongdian/fun";
export default async function (call: ApiCall<ReqRec, ResRec>) {
let _hdinfo = await HuoDongFun.getHdidInfo(call, call.req.hdid)
if (!_hdinfo || Object.keys(_hdinfo).length <= 0) {
// 无此活动
return call.error('', {code: -1, message: globalThis.lng.huodong_open_1})
return call.error('', { code: -1, message: globalThis.lng.huodong_open_1 })
}
let _dbType: `leijichongzhi${number}` = `leijichongzhi${call.req.hdid}`
let conf = _hdinfo.data.tasks[call.req.index];
if (!conf) return call.error('', {code: -1});
if (!conf) return call.error('', { code: -1 });
let db = await G.mongodb.cEvent(_dbType).findOne({uid: call.uid, type: _dbType});
if (db.recIndex.includes(call.req.index)) return call.error('', {code: -2});
let db = await G.mongodb.cEvent(_dbType).findOne({ uid: call.uid, type: _dbType });
if (db.recIndex.includes(call.req.index)) return call.error('', { code: -2 });
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 G.mongodb.cEvent(_dbType).updateOne(
{uid: call.uid, type: _dbType},
{$push: {recIndex: call.req.index}}
G.mongodb.cEvent(_dbType).updateOne(
{ uid: call.uid, type: _dbType },
{ $push: { recIndex: call.req.index } }
);
await checkNextRound(call, db, _hdinfo.data.tasks)
HongDianChange.sendChangeKey(call.uid, ['huodonghd'])
call.succ({
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,
"prize": [
{
"a": "attr",
"t": "rmbmoney",
"a": "item",
"t": "4",
"n": 100
}
],
@ -550,8 +550,8 @@
"mapId": 430,
"prize": [
{
"a": "item",
"t": "4",
"a": "attr",
"t": "rmbmoney",
"n": 5
}
],
@ -589,8 +589,8 @@
"mapId": 460,
"prize": [
{
"a": "attr",
"t": "rmbmoney",
"a": "item",
"t": "4",
"n": 100
}
],
@ -615,8 +615,8 @@
"mapId": 480,
"prize": [
{
"a": "item",
"t": "4",
"a": "attr",
"t": "rmbmoney",
"n": 5
}
],
@ -641,8 +641,8 @@
"mapId": 500,
"prize": [
{
"a": "attr",
"t": "rmbmoney",
"a": "item",
"t": "4",
"n": 100
}
],
@ -680,8 +680,8 @@
"mapId": 530,
"prize": [
{
"a": "item",
"t": "4",
"a": "attr",
"t": "rmbmoney",
"n": 5
}
],
@ -693,8 +693,8 @@
"mapId": 540,
"prize": [
{
"a": "attr",
"t": "rmbmoney",
"a": "item",
"t": "4",
"n": 100
}
],
@ -797,8 +797,8 @@
"mapId": 620,
"prize": [
{
"a": "attr",
"t": "rmbmoney",
"a": "item",
"t": "4",
"n": 100
}
],
@ -810,8 +810,8 @@
"mapId": 630,
"prize": [
{
"a": "item",
"t": "4",
"a": "attr",
"t": "rmbmoney",
"n": 5
}
],
@ -849,8 +849,8 @@
"mapId": 660,
"prize": [
{
"a": "attr",
"t": "rmbmoney",
"a": "item",
"t": "4",
"n": 100
}
],
@ -875,8 +875,8 @@
"mapId": 680,
"prize": [
{
"a": "item",
"t": "4",
"a": "attr",
"t": "rmbmoney",
"n": 5
}
],
@ -901,8 +901,8 @@
"mapId": 700,
"prize": [
{
"a": "attr",
"t": "rmbmoney",
"a": "item",
"t": "4",
"n": 100
}
],
@ -940,8 +940,8 @@
"mapId": 730,
"prize": [
{
"a": "item",
"t": "4",
"a": "attr",
"t": "rmbmoney",
"n": 5
}
],
@ -953,8 +953,8 @@
"mapId": 740,
"prize": [
{
"a": "attr",
"t": "rmbmoney",
"a": "item",
"t": "4",
"n": 100
}
],
@ -1057,8 +1057,8 @@
"mapId": 820,
"prize": [
{
"a": "attr",
"t": "rmbmoney",
"a": "item",
"t": "4",
"n": 100
}
],
@ -1070,8 +1070,8 @@
"mapId": 830,
"prize": [
{
"a": "item",
"t": "4",
"a": "attr",
"t": "rmbmoney",
"n": 5
}
],
@ -1109,8 +1109,8 @@
"mapId": 860,
"prize": [
{
"a": "attr",
"t": "rmbmoney",
"a": "item",
"t": "4",
"n": 100
}
],
@ -1135,8 +1135,8 @@
"mapId": 880,
"prize": [
{
"a": "item",
"t": "4",
"a": "attr",
"t": "rmbmoney",
"n": 5
}
],
@ -1161,8 +1161,8 @@
"mapId": 900,
"prize": [
{
"a": "attr",
"t": "rmbmoney",
"a": "item",
"t": "4",
"n": 100
}
],
@ -1200,8 +1200,8 @@
"mapId": 930,
"prize": [
{
"a": "item",
"t": "4",
"a": "attr",
"t": "rmbmoney",
"n": 5
}
],
@ -1213,8 +1213,8 @@
"mapId": 940,
"prize": [
{
"a": "attr",
"t": "rmbmoney",
"a": "item",
"t": "4",
"n": 100
}
],
@ -1298,109 +1298,5 @@
],
"chapter": 14,
"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;
/**活动信息 */
hdinfo: ReqAddHuoDong;
/** 当前领取轮次 */
round: number
};

View File

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