后台:公告列表
This commit is contained in:
@@ -52,6 +52,27 @@ export default class GameController extends Controller {
|
||||
return
|
||||
}
|
||||
|
||||
public async getNoticeList() {
|
||||
const { ctx } = this;
|
||||
const { page, pageSize, sortField, sortOrder, form } = ctx.request.body;
|
||||
ctx.body = await ctx.service.game.getNoticeList(page, pageSize, sortField, sortOrder, form);
|
||||
return
|
||||
}
|
||||
|
||||
public async updateNotice() {
|
||||
const {ctx} = this;
|
||||
const { id, values } = ctx.request.body;
|
||||
ctx.body = await ctx.service.game.updateNotice(id, values);
|
||||
return
|
||||
}
|
||||
|
||||
public async delNotice() {
|
||||
const {ctx} = this;
|
||||
const { id } = ctx.request.body;
|
||||
ctx.body = await ctx.service.game.delNotice(id);
|
||||
return
|
||||
}
|
||||
|
||||
public async getDicHero() {
|
||||
const { ctx } = this;
|
||||
ctx.body = await ctx.service.game.getDicHero();
|
||||
|
||||
@@ -56,6 +56,9 @@ export default (app: Application) => {
|
||||
router.post('/api/game/updateserverstategy', controller.game.updateServerStategy);
|
||||
router.post('/api/game/createnewserver', controller.game.createNewServer);
|
||||
router.post('/api/game/updateserver', controller.game.updateServer);
|
||||
router.post('/api/game/getnoticelist', controller.game.getNoticeList);
|
||||
router.post('/api/game/updatenotice', controller.game.updateNotice);
|
||||
router.post('/api/game/delnotice', controller.game.delNotice);
|
||||
|
||||
router.post('/api/activity/getactivitylist', tokenParser, controller.activity.getActivityList);
|
||||
router.post('/api/activity/updateactivity', tokenParser, controller.activity.updateActivity);
|
||||
|
||||
@@ -8,6 +8,7 @@ import { DicRMB } from '@pubUtils/dictionary/DicRMB';
|
||||
import { DicActivityType } from '@pubUtils/dictionary/DicActivityType';
|
||||
import { DicTaskType } from '@pubUtils/dictionary/DicTaskType';
|
||||
import { ServerStategyModel, ServerStategyTypeParam } from '@db/ServerStategy';
|
||||
import { NoticeModel, NoticeTypeParam } from '@db/Notice';
|
||||
|
||||
/**
|
||||
* Test Service
|
||||
@@ -157,4 +158,27 @@ export default class Game extends Service {
|
||||
list
|
||||
})
|
||||
}
|
||||
|
||||
public async getNoticeList(page: number, pageSize: number, sortField: string, sortOrder: string, form: { type?: number, content?: string }) {
|
||||
const { ctx } = this;
|
||||
const list = await NoticeModel.findByCondition(page, pageSize, sortField, sortOrder, form);
|
||||
const total = await NoticeModel.countByCondition( form )
|
||||
return ctx.service.utils.resResult(STATUS.SUCCESS, {
|
||||
list, total
|
||||
});
|
||||
}
|
||||
|
||||
public async updateNotice(id: string|number, params: NoticeTypeParam) {
|
||||
const { ctx } = this;
|
||||
let result = await NoticeModel.updateNotice(id, params);
|
||||
if(!result) return ctx.service.utils.resResult(STATUS.WRONG_PARMS);
|
||||
return ctx.service.utils.resResult(STATUS.SUCCESS);
|
||||
}
|
||||
|
||||
public async delNotice(id: number) {
|
||||
const { ctx } = this;
|
||||
let result = await NoticeModel.delNotice(id);
|
||||
if(!result) return ctx.service.utils.resResult(STATUS.WRONG_PARMS);
|
||||
return ctx.service.utils.resResult(STATUS.SUCCESS);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user