import { Application } from 'egg';

export default (app: Application) => {
  const { controller, router } = app;
  const tokenParser = app.middleware.tokenParser();

  router.get('/api', controller.home.index);
  router.post('/api/login/account', controller.login.login);
  router.post('/api/login/changeMyPass', tokenParser, controller.login.changeMyPass);
  router.post('/api/get_route', controller.login.getMenu);
  router.get('/api/currentUser', tokenParser, controller.login.currentUser);
  router.post('/api/upload/hotupdate', tokenParser, controller.upload.upload);
  router.post('/api/upload/uploadjson', tokenParser, controller.upload.uploadJson);
  router.post('/api/upload/reloadresource', tokenParser, controller.upload.reloadResource);
  
  router.post('/api/gmaccount/getgmlist', tokenParser, controller.gmaccount.getGmList);
  router.post('/api/gmaccount/createaccount',tokenParser, controller.gmaccount.createGmAccount);
  router.post('/api/gmaccount/savegmgrouptouser',tokenParser, controller.gmaccount.saveGmGroupToUser);
  router.post('/api/gmaccount/getgrouplist',tokenParser, controller.gmaccount.getGroupList);
  router.post('/api/gmaccount/getapilist',tokenParser, controller.gmaccount.getApiList);
  router.post('/api/gmaccount/saveapi',tokenParser, controller.gmaccount.saveApi);
  router.post('/api/gmaccount/creategmgroup',tokenParser, controller.gmaccount.createGmGroup);
  router.post('/api/gmaccount/savegmgroup',tokenParser, controller.gmaccount.saveGmGroup);
  router.post('/api/gmaccount/saveapitogroup',tokenParser, controller.gmaccount.saveGmApiToGroup);
  
  
  router.post('/api/users/getuserlist',tokenParser, controller.users.getuserlist);
  router.post('/api/users/createrole',tokenParser, controller.users.createRole);
  router.post('/api/users/addauth', tokenParser, controller.users.addAuth);
  router.post('/api/users/fixsms', tokenParser, controller.users.fixSms);
  router.post('/api/users/deleterole',tokenParser, controller.users.deleteRole);
  router.post('/api/users/getrolelist',tokenParser, controller.users.getrolelist);
  router.post('/api/users/createroledata',tokenParser, controller.users.createRoleData);
  router.post('/api/users/getpvpdefense',tokenParser, controller.users.getPveDefense);
  router.post('/api/users/getherolist',tokenParser, controller.users.getHeroList);
  router.post('/api/users/deletehero', tokenParser, controller.users.deleteHero);
  router.post('/api/users/setherolv', tokenParser, controller.users.setHeroLv);
  router.post('/api/users/saveherotodefense',tokenParser, controller.users.saveHeroToDefense);
  router.post('/api/users/removeherofromdefense',tokenParser, controller.users.removeHeroFromDefense);
  router.post('/api/users/getequiplist', tokenParser, controller.users.getEquipList);
  router.post('/api/users/getitemlist', tokenParser, controller.users.getItemList);
  router.post('/api/users/deleteequip', tokenParser, controller.users.deleteEquip);
  router.post('/api/users/deleteitem', tokenParser, controller.users.deleteItem);
  router.post('/api/users/setitemcount', tokenParser, controller.users.setItemCount);

  router.post('/api/game/getserverenv', tokenParser, controller.game.getServerEnv);
  router.post('/api/game/getserverlistbyenv', tokenParser, controller.game.getServerListByEnv);
  router.post('/api/game/getserverlist', controller.game.getServerList);
  router.post('/api/game/getdicgoods', tokenParser, controller.game.getDicGoods);
  router.post('/api/game/getdichero', tokenParser, controller.game.getDicHero);
  router.post('/api/game/getdicrmb', tokenParser, controller.game.getDicRMB);
  router.post('/api/game/getdicactivitytype', tokenParser, controller.game.getDicActivityType);
  router.post('/api/game/getdictasktype', tokenParser, controller.game.getDicTaskType);

  router.post('/api/game/getserverstategylist', controller.game.getServerStategyList);
  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);
  router.post('/api/activity/deleteactivity', tokenParser, controller.activity.deleteActivity);
  router.post('/api/activity/getactivitygrouplist', tokenParser, controller.activity.getActivityGroupList);
  router.post('/api/activity/updateactivitygroupname', controller.activity.updateActivityGroupName);
  router.post('/api/activity/saveactivitiestogroup', tokenParser, controller.activity.saveActivitiesToGroup);
  router.post('/api/activity/savesingleactivitytogroup', controller.activity.saveSingleActivityToGroup);
  router.post('/api/activity/savegrouptoserver', tokenParser, controller.activity.saveGroupToServer);
  router.post('/api/activity/creategroup', tokenParser, controller.activity.createGroup);
  router.post('/api/activity/deletegroup', tokenParser, controller.activity.deleteGroup);
  router.post('/api/activity/getactivitygrouptypelist', controller.activity.getActivityGroupTypeList);
  router.post('/api/activity/saveactivitygrouptypelist', controller.activity.updateActivityGroupType);
  router.post('/api/activity/deleteactivitygrouptype', controller.activity.deleteActivityGroupType);
  router.post('/api/activity/saveactivitygrouptype', controller.activity.saveGroupTypeToActivityGroup);
  router.post('/api/activity/getgroupdatabyid', controller.activity.getGroupDataById);
  router.post('/api/activity/getactivitytaskpoint', controller.activity.getActivityTaskPoint);
  router.post('/api/activity/createtasktoactivity', controller.activity.createTaskToActivity);
  router.post('/api/activity/updateactivitytaskpoint', controller.activity.updateActivityTaskPoint);
  router.post('/api/activity/delactivitytaskpoint', controller.activity.delActivityTaskPoint);

  router.post('/api/mail/getgmmaillist', controller.mail.getGMMailList);
  router.post('/api/mail/updategmmail', controller.mail.updateGMMail);
  router.post('/api/mail/getgmmailrecords', controller.mail.getGMMailRecords);
};
