Compare commits

..

5 Commits

Author SHA1 Message Date
dy
86866e9233 Merge branch 'bugfix' into dev 2023-12-30 16:32:49 +08:00
dy
611898b501 Merge branch 'feature/leichong' into dev 2023-12-30 16:32:38 +08:00
dy
6fd4e79fbe 累计充值 2023-12-30 16:32:26 +08:00
dy
6fae6cd61e 破冰礼包 2023-12-30 16:07:54 +08:00
xcy
45cec85960 patch:
修复元旦活动任务脚本
2023-12-30 15:10:35 +08:00
7 changed files with 208 additions and 35 deletions

View File

@ -22,11 +22,14 @@ export default async function (call: ApiCall<ReqOpen, ResOpen>) {
{upsert: true}
);
}
let payNum = (await PayFun.getPayDaysAllPayNum(call.uid, _hdinfo.stime, _hdinfo.rtime)) * 10
payNum = payNum - (db.round || 0) * R.compose(R.sum(), R.map(i => i.total))(_hdinfo.data.tasks)
call.succ({
sTime: sTime,
recIndex: db?.recIndex || [],
payNum: (await PayFun.getPayDaysAllPayNum(call.uid, _hdinfo.stime, _hdinfo.rtime)) * 10,
hdinfo: _hdinfo
payNum: payNum,
hdinfo: _hdinfo,
round: db.round || 0
});
}

View File

@ -21,14 +21,22 @@ export default async function (call: ApiCall<ReqRec, ResRec>) {
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.compose(R.sum(), R.map(i => i.total))(_hdinfo.data.tasks)
if (payNum < conf.total) return call.error('', {code: -3});
await PlayerFun.sendPrize(call, conf.prize);
G.mongodb.cEvent(_dbType).updateOne(
if (db.recIndex.length + 1 >= _hdinfo.data.tasks.length) {
await G.mongodb.cEvent(_dbType).updateOne(
{uid: call.uid, type: _dbType},
{$set: {recIndex: []}, $inc: {round: 1}}
);
} else {
await G.mongodb.cEvent(_dbType).updateOne(
{uid: call.uid, type: _dbType},
{$push: {recIndex: call.req.index}}
);
}
HongDianChange.sendChangeKey(call.uid, ['huodonghd'])
call.succ({

View File

@ -29,5 +29,5 @@ export default async function (call: ApiCall<ReqReceive, ResReceive>) {
call.succ({})
HongDianChange.sendChangeKey(call.uid, ['pobinglibao']);
HongDianChange.sendChangeKey(call.uid, ['huodonghd']);
}

View File

@ -367,17 +367,21 @@ export class HuoDongHongDianFun {
/**破冰礼包红点 */
static async pobinglibao(call: ApiCall, _hd: ReqAddHuoDong): Promise<hongdianVal> {
let gift = _hd?.data?.gift?.find(i => i.free == true && !i.payId)
if (!gift) return {show: false}
if (gift) return {show: true}
let payLog = await PayFun.getPayLog(call.uid, gift.payId)
payLog = payLog?.filter(i => i.time >= _hd.stime && i.time <= _hd.etime) || []
if (!payLog || !payLog.length) return {show: false}
let payIds = _hd?.data?.gift?.filter(i=>i.payId).map(i=>i.payId)
let payLogs = await PayFun.getPayLogs(call.uid, payIds)
// 取奖励列表,判断是否有可领取奖励
let data = await G.mongodb.cEvent('pobinglibao').findOne({uid: call.uid, type: 'pobinglibao'})
let rec = data?.record?.[call.req.id].length
if (rec && (rec >= 3 || data?.record?.[gift.id] == call.req.recId)) return {show: false}
return {show: true}
for (let item of _hd?.data?.gift){
let rec = data?.record?.[item.id]?.length
if (item.free== true && !item.payId) return {show: true}
if (payLogs[item.payId]?.length && (!rec || rec < PublicShared.getDiff(payLogs[item.payId][0].time))) return {show: true}
}
return {show:false}
}
/**元旦活动红点 */

View File

@ -0,0 +1,149 @@
import { patchFun, patchInit } from "../patch";
import { TanXianFun } from "../public/tanxian";
import { PublicShared } from "../shared/public/public";
class Path {
async fun1(a: any) {
let hdid = 1703860546;
let today_zero_time = PublicShared.getToDayZeroTime();
// 查询今天登录的用户
let today_login_users = await G.mongodb.collection("user").find(
{ loginTime: { $gte: today_zero_time } },
{ projection: { uid: 1 } }
).toArray();
for (let i = 0; i < today_login_users.length; i++) {
let uid = today_login_users[i].uid;
let init: boolean = false;
let hdata:any = await G.mongodb.cEvent(`yuandan${hdid}`).findOne({
uid: uid, type: `yuandan${hdid}`
});
if (!hdata) {
init = true;
hdata = {
uid: uid,
gift: {},
qiandao: {},
gameNum: 0,
exchange: {},
taskfinish: [],
taskval: {
"1": 1,
"2": 0,
"3": 0,
"4": 0,
"5": 0,
"6": 0,
"7": 0,
"8": 0,
"9": 0
},
qiandaoTime: 1,
refreshTime: G.time,
type: `yuandan${hdid}`,
}
}
let taskval = {};
// taskid=1, stype=123 今日登录
taskval["1"] = 1;
// taskid=2, stype=158 今日参与抓娃娃次数
taskval["2"] = hdata.gameNum;
// taskid=3, stype=127 挑战 n 次清缴真主党
let myData = await G.mongodb.cPlayerInfo('qjzzd').findOne({ uid: uid, type: 'qjzzd' });
if (myData?.refreFightTime > PublicShared.getToDayZeroTime()) {
taskval["3"] = myData?.useFightNum || 0;
} else {
taskval["3"] = 0;
}
// taskid=4, stype=155 领取每日任务最终宝箱
let task = await G.mongodb.collection('task').findOne({ uid: uid, taskid: 25 });
if (task && task.lasttime >= today_zero_time && task.finish == 1) {
taskval["4"] = 1;
} else {
taskval["4"] = 0;
}
// taskid=5, stype=142 势力 配置xx 捐献进行 n 次捐献
let jxdata = await G.mongodb.collection('gonghuiUser').findOne({ uid: uid });
if (jxdata && jxdata.jx?.refreshTime > today_zero_time) {
if (jxdata.jx?.record) {
taskval["5"] = jxdata.jx?.record[2] || 0
}
taskval["5"] = 0
} else {
taskval["5"] = 0;
}
// taskid=6, stype=156 每日钻石消耗
taskval["6"] = 0;
let uselogs = (await G.mongodb.collection('rmbuse').find(
{ uid: uid, cTime: { $gte: today_zero_time }, isAdd: false },
{ projection: { change: 1 } }
).toArray()).forEach(e => { taskval["6"] += e.change; });
// taskid=7, stype=122 进行 n 次快速探险
taskval["7"] = 0;
const data = await G.mongodb.collection('tanxian').findOne({ uid: uid });
if (data?.resetTime > PublicShared.getToDayZeroTime()) {
taskval["7"] = data.useFastGuaJiNum || 0
}
// taskid=8, stype=157 获得vip经验
let orde_logs = await G.mongodb.collection('payOrderLog' as any).find(
{ uid: uid, cTime: { $gte: today_zero_time * 1000 } },
).toArray();
taskval["8"] = 0;
orde_logs.forEach(e => {
let pay = G.gc.pay[e.payId];
if (pay) taskval["8"] += pay.payExp[0].n;
})
// taskid=9, stype=157 获得vip经验
taskval["9"] = 0;
orde_logs.forEach(e => {
let pay = G.gc.pay[e.payId];
if (pay) taskval["9"] += pay.payExp[0].n;
})
if (!init) {
await G.mongodb.cEvent(`yuandan${hdid}`).updateOne(
{ uid: uid, type: `yuandan${hdid}` },
{ $set: { taskval: taskval } }
)
} else {
hdata.taskval = taskval;
await G.mongodb.cEvent(`yuandan${hdid}`).updateOne({ uid: uid, type: `yuandan${hdid}` }, { $set: hdata }, { upsert: true })
}
console.log('玩家执行完成',uid)
}
return "sucess!!!"
}
async run() {
await this.fun1(1);
}
}
async function main() {
await patchInit()
let patch = new Path();
await patch.run();
console.log("逻辑执行完成,等待退出");
setTimeout(function () {
console.log('结束程序');
process.exit();
}, 3000);
}
main();

View File

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

View File

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