训练场宝箱展示bug

This commit is contained in:
mamengke01
2021-02-06 11:56:18 +08:00
parent d9bea0444c
commit d9458ede5f
22 changed files with 246 additions and 108 deletions
@@ -78,7 +78,7 @@ export class GmHandler {
return resResult(STATUS.SUCCESS, { msg: content });
}
async addMail(msg: { endTime: number, serverId: number, sendName: string, content: string, goods, sendRoles:[{roleId: string, status: number}], gmMailType: number, sendTime: number, }) {
async addMail(msg: { endTime: number, serverId: number, sendName: string, content: string, goods, sendRoles:[{roleId: string, status: number}], gmMailType: number, sendTime: number }) {
let {sendRoles, endTime, content, sendName, gmMailType, sendTime, goods, serverId} = msg;
let mail = await GMMailModel.addMail({serverId, sendRoles, sendName, endTime, content, gmMailType, sendTime, goods});
setGmMails([mail]);
+27 -7
View File
@@ -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;
}
}