训练场宝箱展示bug
This commit is contained in:
@@ -1,11 +1,12 @@
|
||||
import { Application, ChannelService } from 'pinus';
|
||||
import { resResult } from '../../../pubUtils/util';
|
||||
import { STATUS } from '../../../consts';
|
||||
import { setGmMails, getGmMailById, getGmMails } from '../../../pubUtils/gmData/gmDataUtil';
|
||||
import { setGmMails, getGmMailById, getGmMails, getGmUseMails } from '../../../pubUtils/gmData/gmDataUtil';
|
||||
import { MAIL_TYPE, MAIL_TEM_TYPE } from "../../../consts/constModules/mailConst";
|
||||
import { mailData } from "../../../pubUtils/interface";
|
||||
import { getContent } from '../../../services/mailService';
|
||||
import { findWhere } from 'underscore';
|
||||
import { nowSeconds } from '../../../pubUtils/timeUtil';
|
||||
export default function (app: Application) {
|
||||
return new GMRemote(app);
|
||||
}
|
||||
@@ -102,33 +103,38 @@ export class GMRemote {
|
||||
|
||||
public async getMailInfos(roleId: string, serverId: number, mails: [any], groupMails: [any]) {
|
||||
let list: mailData[] = [];
|
||||
let nowTime = nowSeconds();
|
||||
mails.map(async function({ mailId, goods, sendTime, params, status, _id, mailTemType, sendName, endTime}) {
|
||||
if (mailTemType == MAIL_TEM_TYPE.GAMEMAIL) { //模板邮件
|
||||
if (endTime < nowTime)
|
||||
return;
|
||||
let { content } = getContent(parseInt(mailId), params);
|
||||
if (!content)
|
||||
return;
|
||||
list.push({ id: _id, mailId, goods, sendTime, endTime, content, status, mailType: MAIL_TYPE.SINGLEMAIL, sendName });
|
||||
list.push({ id: _id, goods, sendTime, endTime, content, status, mailType: MAIL_TYPE.SINGLEMAIL, sendName });
|
||||
} else if (mailTemType == MAIL_TEM_TYPE.GMTYPE) { //系统邮件
|
||||
let gmMail = getGmMailById(mailId, serverId);
|
||||
let gmMail = getGmMailById(mailId, serverId, nowTime);
|
||||
if (!gmMail)
|
||||
return;
|
||||
let { goods, sendTime, content, endTime, sendName } = gmMail;
|
||||
list.push({ id: _id, mailId, goods, sendTime, endTime, content, status, mailType: MAIL_TYPE.SINGLEMAIL, sendName });
|
||||
list.push({ id: _id, goods, sendTime, endTime, content, status, mailType: MAIL_TYPE.SINGLEMAIL, sendName });
|
||||
}
|
||||
});
|
||||
groupMails.map(async function({ mailId, goods, sendTime, endTime, params, sendRoles, _id, mailTemType, sendName }) {
|
||||
let { status } = findWhere(sendRoles, {roleId});
|
||||
if (mailTemType == MAIL_TEM_TYPE.GAMEMAIL) { //模板邮件
|
||||
if (endTime < nowTime)
|
||||
return;
|
||||
let { content } = getContent( parseInt(mailId), params);
|
||||
if (!content)
|
||||
return;
|
||||
list.push({ id: _id, mailId, goods, sendTime, content, endTime, status, mailType: MAIL_TYPE.GROUPMAIL, sendName });
|
||||
list.push({ id: _id, goods, sendTime, content, endTime, status, mailType: MAIL_TYPE.GROUPMAIL, sendName });
|
||||
} else if (mailTemType == MAIL_TEM_TYPE.GMTYPE) { //系统邮件
|
||||
let gmMail = getGmMailById(mailId, serverId);
|
||||
let gmMail = getGmMailById(mailId, serverId, nowTime);
|
||||
if (!gmMail)
|
||||
return;
|
||||
let { goods, sendTime, content, endTime, sendName } = gmMail;
|
||||
list.push({ id: _id, mailId, goods, sendTime, endTime, content, status, mailType: MAIL_TYPE.GROUPMAIL, sendName });
|
||||
list.push({ id: _id, goods, sendTime, endTime, content, status, mailType: MAIL_TYPE.GROUPMAIL, sendName });
|
||||
}
|
||||
});
|
||||
return list;
|
||||
@@ -138,4 +144,18 @@ export class GMRemote {
|
||||
let gmMails = getGmMails(updatedMailAt, serverId);
|
||||
return gmMails;
|
||||
}
|
||||
public async getUseMails(serverId: number) {
|
||||
let gmMails = getGmUseMails(serverId);
|
||||
return gmMails;
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param mailId
|
||||
* @param serverId
|
||||
* @param nowTime
|
||||
*/
|
||||
public getUseGmMailById(mailId: string, serverId: number, nowTime: number ) {
|
||||
let gmMail = getGmMailById(mailId, serverId, nowTime);
|
||||
return gmMail;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user