后台:权限

This commit is contained in:
luying
2021-12-21 19:42:37 +08:00
parent 151ac33b91
commit 7d0808a9dc
26 changed files with 1009 additions and 818 deletions
-127
View File
@@ -23,32 +23,6 @@ import { DicServerName } from '@pubUtils/dictionary/DicServerName';
*/
export default class Game extends Service {
/**
* 获取正式服,测试服,开发服等环境
*/
// public async getServerListByEnv() {
// const { ctx, app } = this;
// let env = app.config.env
// let serverEnv = await GameModel.getServerEnvList();
// let curEnv = serverEnv.find(cur => cur.env == env);
// const list = await ServerlistModel.findByServerType(curEnv?.serverType);
// return ctx.service.utils.resResult(STATUS.SUCCESS, {
// list
// });
// }
// public async getServerList(page: number, pageSize: number, sortField: string, sortOrder: string, form: { id?: number, serverId?: string|number, name?: string, groupName?: string, groupId?: number, serverType?: string } = {}) {
// const { ctx } = this;
// const list = await ServerlistModel.findByCondition(page, pageSize, sortField, sortOrder, form);
// const total = await ServerlistModel.countByCondition( form )
// return ctx.service.utils.resResult(STATUS.SUCCESS, {
// list, total
// });
// }
public async getRegions() {
const { ctx } = this;
@@ -130,107 +104,6 @@ export default class Game extends Service {
return ctx.service.utils.resResult(STATUS.SUCCESS, { whitelist });
}
// public async getMaintenanceList(page: number, pageSize: number, sortField: string, sortOrder: string, form: { isOpen?: boolean } = {}) {
// const { ctx } = this;
// const list = await MaintenanceModel.findByCondition(page, pageSize, sortField, sortOrder, form);
// const total = await MaintenanceModel.countByCondition( form )
// return ctx.service.utils.resResult(STATUS.SUCCESS, {
// list: list.map(cur => {
// let marquee = <MarqueeType>cur.marquee;
// let notice = <NoticeType>cur.notice;
// return {
// ...cur, startTime: cur.startTime.getTime(),
// marquee: marquee?{...marquee, startTime: marquee.startTime.getTime(), endTime: marquee.endTime.getTime()}:null,
// notice: notice?{...notice, showStartTime: notice.showStartTime.getTime(), showEndTime: notice.showEndTime.getTime()}:null
// }
// }), total
// });
// }
// public async updateMaintenance(values: MaintenanceTypeParam, marquee: MarqueeParam, notice: NoticeTypeParam, mail: GMMailTypeParam) {
// const { ctx } = this;
// if(values.code == 'new') {
// let serverEnv = await GameModel.getServerEnvList();
// let curEnv = serverEnv.find(cur => cur.env == this.app.config.env);
// 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, null);
// } else {
// let maintenanceResult = await MaintenanceModel.updateData(values.code, values, ctx.user?.uid);
// if(!maintenanceResult) return ctx.service.utils.resResult(STATUS.WRONG_PARMS);
// let marqueeResult = <MarqueeType>maintenanceResult.marquee;
// let noticeResult = <NoticeType>maintenanceResult.notice;
// let mailResult = <GMMailType>maintenanceResult.mail;
// if(marqueeResult) await MarqueeModel.updateData(marqueeResult.code, marquee, ctx.user?.uid);
// if(noticeResult) await NoticeModel.updateNotice(noticeResult.id, notice, ctx.user?.uid);
// if(mailResult) await GMMailModel.updateMailById(mailResult._id, mail, ctx.user?.uid);
// }
// return ctx.service.utils.resResult(STATUS.SUCCESS);
// }
// public async getServerStategyList(page: number, pageSize: number, sortField: string, sortOrder: string, form: { id?: number, name?: string }) {
// const { ctx } = this;
// const list = await ServerStategyModel.findByCondition(page, pageSize, sortField, sortOrder, form);
// const total = await ServerStategyModel.countByCondition( form )
// return ctx.service.utils.resResult(STATUS.SUCCESS, {
// list, total
// });
// }
// public async updateServerStategy(values: ServerStategyTypeParam & {id: string|number}) {
// const { ctx } = this;
// try {
// await ServerStategyModel.updateServerStategy(values, ctx.user?.uid);
// } catch(e) {
// return ctx.service.utils.resResult(STATUS.INTERNAL_ERR, null, (<Error>e).stack);
// }
// return ctx.service.utils.resResult(STATUS.SUCCESS);
// }
// public async createNewServer(name: string, openTime: number, serverType: string, stategyId: number ) {
// const { ctx } = this;
// try {
// let stategy = await ServerStategyModel.findBySId(stategyId);
// if(!stategy) return ctx.service.utils.resResult(STATUS.GM_STATEGY_NOT_FOUND);
// await ServerlistModel.newServer({ name, openTime: new Date(openTime), serverType }, stategy, ctx.user?.uid);
// } catch(e) {
// return ctx.service.utils.resResult(STATUS.INTERNAL_ERR, null, (<Error>e).stack);
// }
// return ctx.service.utils.resResult(STATUS.SUCCESS);
// }
// public async updateServer(id: number, name: string, groupName: string, serverStatus: number ) {
// const { ctx } = this;
// try {
// let server = await ServerlistModel.findByServerId(id);
// if(!server) return ctx.service.utils.resResult(STATUS.GM_SERVER_NOT_FOUND);
// if(server.groupName != groupName) {
// await ServerlistModel.updateGroupName(server.groupId, groupName);
// }
// let update: ServerlistUpdate = {};
// if(name) update['name'] = name;
// if(groupName) update['groupName'] = groupName;
// if(serverStatus) update['serverStatus'] = serverStatus;
// await ServerlistModel.updateByServerId(id, update);
// } catch(e) {
// return ctx.service.utils.resResult(STATUS.INTERNAL_ERR, null, (<Error>e).stack);
// }
// return ctx.service.utils.resResult(STATUS.SUCCESS);
// }
public async getDicHero() {
let list: DicHero[] = [];
for(let [heroId, hero] of gameData.hero) {