import { UpdateChannelParam } from '../domain/backEndField/params';
import { Controller } from 'egg';

export default class GameController extends Controller {

  public async getRegions() {
    const { ctx } = this;

    ctx.body = await ctx.service.game.getRegions();
    return
  }

  public async createRegion() {
    const { ctx } = this;

    const { values } = ctx.request.body;
    ctx.body = await ctx.service.game.createRegion(values);
    return
  }

  public async getRegionStategy() {
    const { ctx } = this;
    const { id } = ctx.request.body;

    ctx.body = await ctx.service.game.getRegionStategy(id);
    return
  }

  public async getWhiteList() {
    const { ctx } = this;
    const { id } = ctx.request.body;

    ctx.body = await ctx.service.game.getWhiteList(id);
    return
  }

  public async updateWhiteList() {
    const { ctx } = this;
    const { id, code, type, content } = ctx.request.body;

    ctx.body = await ctx.service.game.updateWhiteList(id, code, type, content);
    return
  }

  public async deleteWhiteList() {
    const { ctx } = this;
    const { id, code } = ctx.request.body;

    ctx.body = await ctx.service.game.deleteWhiteList(id, code);
    return
  }

  public async getServers() {
    const { ctx } = this;

    ctx.body = await ctx.service.game.getServers();
    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();
    return
  }

  public async stopServerRegister() {
    const { ctx } = this;
    const { id } = ctx.request.body;

    ctx.body = await ctx.service.game.stopServerRegister(id);
    return
  }

  public async switchServerStatus() {
    const { ctx } = this;
    const { id, status } = ctx.request.body;

    ctx.body = await ctx.service.game.switchServerStatus(id, status);
    return
  }

  public async switchServerReview() {
    const { ctx } = this;
    const { id, isReview } = ctx.request.body;

    ctx.body = await ctx.service.game.switchServerReview(id, isReview);
    return
  }

  public async getOrderlist() {
    const { ctx } = this;
    const { page, pageSize, sortField, sortOrder, form  } = ctx.request.body;
    ctx.body = await ctx.service.game.getOrderlist(page, pageSize, sortField, sortOrder, form);
    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 getMarqueeList() {
    const { ctx } = this;
    const { page, pageSize, sortField, sortOrder, form  } = ctx.request.body;
    ctx.body = await ctx.service.game.getMarqueeList(page, pageSize, sortField, sortOrder, form);
    return
  }

  public async updateMarquee() {
    const { ctx } = this;
    const { code, values  } = ctx.request.body;
    ctx.body = await ctx.service.game.updateMarquee(code, values);
    return
  }

  public async getSurveylist() {
    const { ctx } = this;
    const { page, pageSize, sortField, sortOrder, form  } = ctx.request.body;
    ctx.body = await ctx.service.game.getSurveylist(page, pageSize, sortField, sortOrder, form);
    return
  }

  public async getAccuse() {
    const { ctx } = this;
    const { page, pageSize, sortField, sortOrder, form } = ctx.request.body;
    ctx.body = await ctx.service.game.getAccuse(page, pageSize, sortField, sortOrder, form);
    return
  }

  public async getDicHero() {
    const { ctx } = this;
    ctx.body = await ctx.service.game.getDicHero();
    return 
  }

  public async getDicGoods() {
    const { ctx } = this;
    ctx.body = await ctx.service.game.getDicGoods();
    return 
  }

  public async getDicRMB() {
    const { ctx } = this;
    ctx.body = await ctx.service.game.getDicRmb();
    console.log('******', ctx.body)
    return
  }

  public async getDicActivityType() {
    const { ctx } = this;
    ctx.body = await ctx.service.game.getDicActivityType();
    return
  }

  public async getDicTaskType() {
    const { ctx } = this;
    ctx.body = await ctx.service.game.getDicTaskType();
    return
  }

  public async getServerName() {
    const { ctx } = this;
    ctx.body = await ctx.service.game.getServerName();
    return
  }

  public async getPvpConfig() {
    const { ctx } = this;
    const { page, pageSize, sortField, sortOrder } = ctx.request.body;
    ctx.body = await ctx.service.game.getPvpConfig(page, pageSize, sortField, sortOrder);
    return
  }

  public async getHiddenData() {
    const { ctx } = this;
    const { page, pageSize, sortField, sortOrder, form } = ctx.request.body;
    ctx.body = await ctx.service.game.getHiddenData(page, pageSize, sortField, sortOrder, form);
    return
  }

  public async getExistHiddenData() {
    const { ctx } = this;
    const { type } = ctx.request.body;
    ctx.body = await ctx.service.game.getExistHiddenData(type);
    return
  }

  public async getGVGServerGroup() {
    const { ctx } = this;
    ctx.body = await ctx.service.game.getGVGServerGroup();
    return
  }

  public async getGVGConfig() {
    const { ctx } = this;
    ctx.body = await ctx.service.game.getGVGConfig();
    return
  }
}
