From 0932d3ee4741688c0c209afd2253c7b462b17bed Mon Sep 17 00:00:00 2001 From: xichaoyin Date: Wed, 10 Jan 2024 15:46:41 +0800 Subject: [PATCH 1/3] =?UTF-8?q?patch:=E7=BB=88=E8=BA=AB=E5=8D=A1=E5=91=A8?= =?UTF-8?q?=E5=A5=96=E5=8A=B1=E8=A1=A5=E5=8F=91=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/fix_patch/patch_20240110.ts | 82 +++++++++++++++++++++++++++++++-- 1 file changed, 78 insertions(+), 4 deletions(-) diff --git a/src/fix_patch/patch_20240110.ts b/src/fix_patch/patch_20240110.ts index 1597954..8f48a19 100644 --- a/src/fix_patch/patch_20240110.ts +++ b/src/fix_patch/patch_20240110.ts @@ -1,8 +1,44 @@ +import { ReqEmail } from "../monopoly/protocols/PtlEmail"; import { patchInit } from "../patch"; +import { MsgEmail } from "../shared/protocols/msg_s2c/MsgEmail"; +import { PublicShared } from "../shared/public/public"; class Path { + async addEmail(email: ReqEmail & { createTime?: number; }) { + let { prize, uid, ...e } = email; + let lng = await G.redis.rawGet(`user:lng:${uid}`) + + let sendEmail: MsgEmail = { + _id: null, + uid: uid, + type: e.type, + title: e.lngTitle ? (e.lngTitle[lng] || e.lngTitle['ja']) : e.title, + content: e.lngContent ? (e.lngContent[lng] || e.lngContent['ja']) : e.content, + createTime: e.createTime || G.time, + contentInsertArr: e.contentInsertArr || [] + }; + + if (prize?.length > 0) { + sendEmail.prizeData = { + prize: email.prize, + isGet: false + }; + } + + if (email.g123log && Object.keys(email.g123log).length > 0) sendEmail.g123log = email.g123log; + + if (email.lngTitle) { + sendEmail.lngTitle = email.lngTitle + sendEmail.lngContent = email.lngContent + } + + await G.mongodb.collection('email').insertOne({ + ttl: new Date(), ...G.mongodb.conversionIdObj(sendEmail) + }); + } + async fun1(a: any) { let taskType = 2; let users = await G.mongodb.collection('user').find({ loginTime: { $gte: 1704643200 } }).toArray(); @@ -13,18 +49,56 @@ class Path { }, { projection: { taskid: 1 } }).toArray()).map(i => i.taskid); if (unFinishTask.length >= 2) { - unFinishTask.sort().slice(1); + let deltask = unFinishTask.sort().slice(1); await G.mongodb.collection("task").deleteOne({ - uid: user.uid, taskid: { $in: unFinishTask } + uid: user.uid, taskid: { $in: deltask } }); - console.log(`删除玩家${user.uid}任务:${unFinishTask}`); + console.log(`删除玩家${user.uid}任务:${deltask}`); + } + } + } + /** + * 补发玩家终身卡奖励 + */ + async fun2(a: any) { + let logs = await G.mongodb.collection("payLogNew").find( + { key: "zhongshenka", del_time: { $exists: false } }, { projection: { _id: 0, } } + ).toArray(); + + if (logs.length == 0) { + console.log("没有终身卡数据,不发放终身卡"); + } + let wzt = PublicShared.getToWeekMondayZeroTime(); + let con = G.gc.payEmail.zhongshenka.filter(e => e.day == 7)[0]; + for (let i = 0; i < logs.length; i++) { + + // 查询玩家邮件 + let emails = await G.mongodb.collection('email').find({ + uid: logs[i].uid, title: con.title, createTime: { $gte: wzt } + }).toArray(); + + + if (emails.length == 0) { + // 发送邮件 + this.addEmail({ + uid: logs[i].uid, + type: "system", + title: con.title, + content: con.content, + contentInsertArr: [], + createTime: G.time, + prize: con.prize, + }) + console.log("发放终身卡", logs[i].uid); + } else { + console.log("本周已发送过 不发放终身卡", logs[i].uid); } } } - async run() { await this.fun1(1); + await this.fun2(1); } } From ca3e973afd18a2cf44bb76e35bdc320d341bcdc2 Mon Sep 17 00:00:00 2001 From: xichaoyin Date: Wed, 10 Jan 2024 15:50:49 +0800 Subject: [PATCH 2/3] =?UTF-8?q?patch:=E7=BB=88=E8=BA=AB=E5=8D=A1=E5=91=A8?= =?UTF-8?q?=E5=A5=96=E5=8A=B1=E8=A1=A5=E5=8F=91=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/fix_patch/patch_20240110.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/fix_patch/patch_20240110.ts b/src/fix_patch/patch_20240110.ts index 8f48a19..9bfeeec 100644 --- a/src/fix_patch/patch_20240110.ts +++ b/src/fix_patch/patch_20240110.ts @@ -67,7 +67,9 @@ class Path { if (logs.length == 0) { console.log("没有终身卡数据,不发放终身卡"); + return } + let wzt = PublicShared.getToWeekMondayZeroTime(); let con = G.gc.payEmail.zhongshenka.filter(e => e.day == 7)[0]; for (let i = 0; i < logs.length; i++) { From a26aa7dab33ecdcf50d6fe0e4237531b2df43f37 Mon Sep 17 00:00:00 2001 From: yushunrui <364203175@qq.com> Date: Wed, 10 Jan 2024 16:44:53 +0800 Subject: [PATCH 3/3] =?UTF-8?q?fix:=E5=A4=84=E7=90=86=E5=BC=BA=E5=8C=96?= =?UTF-8?q?=E4=BC=99=E4=BC=B4=E6=B4=BB=E5=8A=A8=E5=88=9D=E5=A7=8B=E6=B2=A1?= =?UTF-8?q?=E6=9C=89=E4=BB=BB=E5=8A=A1=E8=BF=9B=E5=BA=A6=E7=9A=84=E9=80=BB?= =?UTF-8?q?=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api_s2c/event/chuanshuozhilu/ApiOpen.ts | 30 +++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/src/api_s2c/event/chuanshuozhilu/ApiOpen.ts b/src/api_s2c/event/chuanshuozhilu/ApiOpen.ts index 27dd5d5..a1d648d 100644 --- a/src/api_s2c/event/chuanshuozhilu/ApiOpen.ts +++ b/src/api_s2c/event/chuanshuozhilu/ApiOpen.ts @@ -12,11 +12,37 @@ export default async function (call: ApiCall) { // 无此活动 return call.error('', { code: -1, message: globalThis.lng.huodong_open_1 }) } - let db = await G.mongodb.cEvent(`chuanshuozhilu${call.req.hdid}`).findOne({ uid: call.uid, type: `chuanshuozhilu${call.req.hdid}` }); + let _info = db?.info || {} + // 如果初始没有数据,就判断玩家是否有活动对应的影响,生成一下初始化数据 + if (!db) { + + let _dbType: `chuanshuozhilu${number}` = `chuanshuozhilu${call.req.hdid}` + const hid = _hdinfo.data.hid + let heros = await G.mongodb.collection("hero").find({uid: call.uid, heroId: hid}) + .sort({ "zhanli": -1 }).limit(1).toArray(); + + if (heros) { + let hero = heros[0] + const lv = hero.lv || 0 + const jieji = hero.jieji || 0 + let setInfo = {"lv": lv, "jieji": jieji} + await G.mongodb.cEvent(_dbType).updateOne( + { uid: call.uid, type: _dbType }, + { $set: G.mongodb.createTreeObj({ key: `info.${hid}`, val: setInfo})}, + { upsert: true} + ) + if (!cache[call.uid]) cache[call.uid] = {hid:{}}; + if (!cache[call.uid][hid]) cache[call.uid][hid] = setInfo; + _info[hid] = setInfo + G.server.sendMsgByUid(call.uid, 'msg_s2c/HongDianChange', ['huodonghd']); + } + + } + call.succ({ - info: db?.info || {}, + info: _info, hdinfo: _hdinfo }); }