渠道协议后台
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import { UpdateChannelParam } from '@domain/backEndField/params';
|
||||
import { Controller } from 'egg';
|
||||
|
||||
export default class GameController extends Controller {
|
||||
@@ -56,6 +57,21 @@ export default class GameController extends Controller {
|
||||
return
|
||||
}
|
||||
|
||||
public async getChannelInfo() {
|
||||
const { ctx } = this;
|
||||
|
||||
ctx.body = await ctx.service.game.getChannelInfo();
|
||||
return
|
||||
}
|
||||
|
||||
public async updateChannel() {
|
||||
const { ctx } = this;
|
||||
const obj = ctx.request.body;
|
||||
let param = new UpdateChannelParam(obj?.values||{});
|
||||
ctx.body = await ctx.service.game.updateChannel(param);
|
||||
return
|
||||
}
|
||||
|
||||
public async getOnlineUsersByServer() {
|
||||
const { ctx } = this;
|
||||
ctx.body = await ctx.service.game.getOnlineUsersByServer();
|
||||
|
||||
@@ -54,6 +54,8 @@ export default (app: Application) => {
|
||||
router.post('/api/game/switchserverreview', tokenParser, controller.game.switchServerReview);
|
||||
router.post('/api/game/getorderlist', tokenParser, controller.game.getOrderlist);
|
||||
router.post('/api/game/getsurveylist', tokenParser, controller.game.getSurveylist);
|
||||
router.post('/api/game/getchannelinfo', controller.game.getChannelInfo);
|
||||
router.post('/api/game/updatechannel', controller.game.updateChannel);
|
||||
|
||||
router.post('/api/dic/getdicgoods', tokenParser, controller.game.getDicGoods);
|
||||
router.post('/api/dic/getdichero', tokenParser, controller.game.getDicHero);
|
||||
|
||||
@@ -16,10 +16,11 @@ import { WhiteListModel } from '@db/RegionWhiteList';
|
||||
import { RoleModel } from '@db/Role';
|
||||
import { SearchMarqueeParam, SearchOrderParam, SearchSurveyParam } from '@domain/backEndField/search';
|
||||
import { DicServerName } from '@pubUtils/dictionary/DicServerName';
|
||||
import { CreateRegionParam } from '@domain/backEndField/params';
|
||||
import { CreateRegionParam, UpdateChannelParam } from '@domain/backEndField/params';
|
||||
import { UserOrderModel } from '@db/UserOrder';
|
||||
import { SurveyModel } from '@db/Survery';
|
||||
import { RedisClient } from 'redis';
|
||||
import { ChannelInfoModel } from '@db/ChannelInfo';
|
||||
|
||||
/**
|
||||
* Test Service
|
||||
@@ -61,6 +62,24 @@ export default class Game extends Service {
|
||||
});
|
||||
}
|
||||
|
||||
public async getChannelInfo() {
|
||||
const { ctx } = this;
|
||||
|
||||
const list = await ChannelInfoModel.findAll();
|
||||
return ctx.service.utils.resResult(STATUS.SUCCESS, {
|
||||
list
|
||||
});
|
||||
}
|
||||
|
||||
public async updateChannel(param: UpdateChannelParam) {
|
||||
const { ctx } = this;
|
||||
if(!param.checkParams()) return ctx.service.utils.resResult(STATUS.WRONG_PARMS);
|
||||
|
||||
await ChannelInfoModel.updateChannel(param.code, param);
|
||||
return ctx.service.utils.resResult(STATUS.SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
public async getOnlineUsersByServer() {
|
||||
const { ctx } = this;
|
||||
let redisClient: RedisClient = ctx.app.context.redisClient;
|
||||
|
||||
Reference in New Issue
Block a user