邮件:定时循环邮件

This commit is contained in:
luying
2022-05-21 16:26:00 +08:00
parent 367208f780
commit 03bb62e60b
11 changed files with 31 additions and 15 deletions

View File

@@ -427,10 +427,11 @@ async function sendCircleMail() {
let gmmails = await GMMailModel.findCircleMails(pinus.app.get('env'));
let f = new SendMailFun();
for(let gmmail of gmmails) {
let { receivers, mailType, sendTimes } = gmmail;
let { receivers, mailType, sendTimes, circleStart, circleEnd } = gmmail;
let code = await f.setWithGmMail(gmmail);
if(!code) continue;
let mapTemp = f.getMailTemp(code);
if(sendTimes.indexOf(mapTemp.sendTime) == -1) {
if(sendTimes.indexOf(mapTemp.sendTime) == -1 && circleStart <= mapTemp.sendTime && circleEnd >= mapTemp.sendTime) {
if(mailType == GM_MAIL_TYPE.SINGLE) {
await f.createSingleMails(code, receivers.map(cur => cur.roleId));
} else if (mailType == GM_MAIL_TYPE.GROUP) {