后台:添加跑马灯

This commit is contained in:
luying
2021-07-02 19:24:39 +08:00
parent d2e7edabea
commit 4d9c5482ac
4 changed files with 84 additions and 0 deletions
+27
View File
@@ -9,6 +9,7 @@ import { DicActivityType } from '@pubUtils/dictionary/DicActivityType';
import { DicTaskType } from '@pubUtils/dictionary/DicTaskType';
import { ServerStategyModel, ServerStategyTypeParam } from '@db/ServerStategy';
import { NoticeModel, NoticeTypeParam } from '@db/Notice';
import { MarqueeModel, MarqueeParam } from '@db/Marquee';
/**
* Test Service
@@ -187,4 +188,30 @@ export default class Game extends Service {
if(!result) return ctx.service.utils.resResult(STATUS.WRONG_PARMS);
return ctx.service.utils.resResult(STATUS.SUCCESS);
}
public async getMarqueeList(page: number, pageSize: number, sortField: string, sortOrder: string, form: { type?: number, current?: boolean, content?: string }) {
const { ctx } = this;
const list = await MarqueeModel.findByCondition(page, pageSize, sortField, sortOrder, form);
const total = await MarqueeModel.countByCondition( form )
return ctx.service.utils.resResult(STATUS.SUCCESS, {
list: list.map(cur => {
return { ...cur, startTime: cur.startTime.getTime(), endTime: cur.endTime.getTime() }
}), total
});
}
public async updateMarquee(code: string, params: MarqueeParam) {
const { ctx } = this;
if(params.startTime) params.startTime = new Date(params.startTime);
if(params.endTime) params.endTime = new Date(params.endTime);
let result;
if(code == 'new') {
result = await MarqueeModel.createData(params);
} else {
result = await MarqueeModel.updateData(code, params);
}
if(!result) return ctx.service.utils.resResult(STATUS.WRONG_PARMS);
return ctx.service.utils.resResult(STATUS.SUCCESS);
}
}