Merge remote-tracking branch 'origin/bugfix' into bugfix
This commit is contained in:
commit
7feff43ee6
@ -1,8 +1,44 @@
|
|||||||
|
import { ReqEmail } from "../monopoly/protocols/PtlEmail";
|
||||||
import { patchInit } from "../patch";
|
import { patchInit } from "../patch";
|
||||||
|
import { MsgEmail } from "../shared/protocols/msg_s2c/MsgEmail";
|
||||||
|
import { PublicShared } from "../shared/public/public";
|
||||||
|
|
||||||
|
|
||||||
class Path {
|
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) {
|
async fun1(a: any) {
|
||||||
let taskType = 2;
|
let taskType = 2;
|
||||||
let users = await G.mongodb.collection('user').find({ loginTime: { $gte: 1704643200 } }).toArray();
|
let users = await G.mongodb.collection('user').find({ loginTime: { $gte: 1704643200 } }).toArray();
|
||||||
@ -13,18 +49,58 @@ class Path {
|
|||||||
}, { projection: { taskid: 1 } }).toArray()).map(i => i.taskid);
|
}, { projection: { taskid: 1 } }).toArray()).map(i => i.taskid);
|
||||||
|
|
||||||
if (unFinishTask.length >= 2) {
|
if (unFinishTask.length >= 2) {
|
||||||
unFinishTask.sort().slice(1);
|
let deltask = unFinishTask.sort().slice(1);
|
||||||
await G.mongodb.collection("task").deleteOne({
|
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("没有终身卡数据,不发放终身卡");
|
||||||
|
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++) {
|
||||||
|
|
||||||
|
// 查询玩家邮件
|
||||||
|
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() {
|
async run() {
|
||||||
await this.fun1(1);
|
await this.fun1(1);
|
||||||
|
await this.fun2(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user