登录:公告读数据库

This commit is contained in:
luying
2021-03-05 17:41:53 +08:00
parent f1e9c1efd6
commit 9b533b54a3
5 changed files with 106 additions and 67 deletions

View File

@@ -2,6 +2,7 @@ import { STATUS } from '@consts';
import { GameModel } from '@db/Game';
import { Controller } from 'egg';
import { RoleModel } from '@db/Role';
import { NoticeModel } from '@db/Notice';
import { ServerParamWithRole, GroupParam } from '../domain/gameField/serverlist';
export default class GameController extends Controller {
@@ -67,16 +68,15 @@ export default class GameController extends Controller {
let { serverType } = ctx;
console.log(serverType);
let notice = [{
id: 1,
title: '粮草先行',
tag: 1,
type: 1,
content: '欢迎来到三国志赵云传',
startTime: 1584921600,
endTime: 1585353600
}]
ctx.body = ctx.service.utils.resResult(STATUS.SUCCESS, { notice });
let notice = await NoticeModel.getAllNotice(serverType);
let result = notice.map(cur => {
let {id, title, tag, type, content, time} = cur;
return {
id, title, tag, type, content, time
}
})
ctx.body = ctx.service.utils.resResult(STATUS.SUCCESS, { notice: result });
return
}