后台:发送邮件

This commit is contained in:
luying
2021-06-29 20:47:56 +08:00
parent ad2cd0f734
commit 04d72a1956
7 changed files with 122 additions and 23 deletions
+26
View File
@@ -0,0 +1,26 @@
import { Service } from 'egg';
import { GMMailModel } from '@db/GMMail';
import { STATUS } from '@consts';
export default class Mail extends Service {
public async getGMMailList(page: number, pageSize: number, sortField: string, sortOrder: string, form: {}) {
const { ctx } = this;
const list = await GMMailModel.findByCondition(page, pageSize, sortField, sortOrder, form);
const total = await GMMailModel.countByCondition( form )
return ctx.service.utils.resResult(STATUS.SUCCESS, {
list, total
});
}
public async updateGMMail(_id: string, content: string, sendName: string, useTempTime: boolean, sendTime: number, endTime: number, continueHour: number) {
const { ctx } = this;
if(_id == 'new') {
await GMMailModel.addMail({ content, sendName, useTempTime, sendTime, endTime, continueHour });
} else {
await GMMailModel.updateMailById(_id, { content, sendName, useTempTime, sendTime, endTime, continueHour });
}
return ctx.service.utils.resResult(STATUS.SUCCESS);
}
}