后台:邮件

This commit is contained in:
luying
2021-12-01 11:30:25 +08:00
parent c4e4e472d1
commit 53e55b288f
16 changed files with 192 additions and 83 deletions
+2 -2
View File
@@ -90,8 +90,8 @@ export default class Game extends Service {
let marqueeResult = await MarqueeModel.createData({ ...marquee, serverIds: values.serverIds, type: MARQUEE_TYPE.SCHEDULE, isRunning: false }, ctx.user?.uid);
let noticeResult = await NoticeModel.updateNotice('new', { ...notice, type: 1, sort: 1000, serverType: curEnv?.serverType, isEnable: false }, ctx.user?.uid);
let mailResult = await GMMailModel.addMail({ ...mail, }, ctx.user?.uid);
await MaintenanceModel.createData(values, marqueeResult, noticeResult, mailResult);
// let mailResult = await GMMailModel.addMail(mail, ctx.user?.uid);
await MaintenanceModel.createData(values, marqueeResult, noticeResult, null);
} else {
let maintenanceResult = await MaintenanceModel.updateData(values.code, values, ctx.user?.uid);
if(!maintenanceResult) return ctx.service.utils.resResult(STATUS.WRONG_PARMS);
+27 -6
View File
@@ -1,10 +1,11 @@
import { Service } from 'egg';
import { GMMailModel } from '@db/GMMail';
import { GMMailModel, } from '@db/GMMail';
import { STATUS } from '@consts';
import { GMMailRecordModel } from '@db/GMMailRecord';
import { RewardInter } from '@pubUtils/interface';
import { SearchMailParam } from '@domain/backEndField/search';
import { UpdateMailParams } from '@domain/backEndField/params';
import { RoleModel, RoleType } from '@db/Role';
export default class Mail extends Service {
@@ -17,12 +18,32 @@ export default class Mail extends Service {
});
}
public async updateGMMail(_id: string, goods: RewardInter[]) {
public async findRoleByIdOrName(serverId: number, roleId: string, roleName: string) {
let role: RoleType;
if(roleId) {
role = await RoleModel.findByRoleId(roleId);
}
if(roleName) {
role = await RoleModel.findByRoleName(roleName);
}
if(!role || role.serverId != serverId) return this.ctx.service.utils.resResult(STATUS.WRONG_PARMS);
return this.ctx.service.utils.resResult(STATUS.SUCCESS, { env: this.ctx.app.config.realEnv, serverId, roleId: role.roleId, roleName: role.roleName })
}
public async createGmMail(params: UpdateMailParams) {
const { ctx } = this;
if(_id == 'new') {
await GMMailModel.addMail({ goods });
await GMMailModel.addMail(params);
return ctx.service.utils.resResult(STATUS.SUCCESS);
}
public async updateGMMail(isCreate: boolean, params: UpdateMailParams) {
const { ctx } = this;
if(isCreate) {
await GMMailModel.addMail(params);
} else {
await GMMailModel.updateMailById(_id, { goods });
// await GMMailModel.updateMailById(params._id, params);
}
return ctx.service.utils.resResult(STATUS.SUCCESS);
}