/** * @return string */ public function __invoke() { /** @var \GameBackend\Entity\SRO\Shard\SiegeFortress[] $fortressList */ $fortressList = $this->serviceCache->getItem('PServerSROFortressInfo', function () { $gameBackend = $this->gameDataService; $guildList = null; if ($gameBackend instanceof SRO) { $guildList = $gameBackend->getFortressGuildList(); } return $guildList; }, 180); $fortressFilterList = []; foreach ($fortressList as $fortress) { if ($this->fortressOptions->getMod() == FortressOptions::MOD_VALID_GUILD) { if (!$fortress->getGuild() || $fortress->getGuild()->getId() < 1) { continue; } } if (in_array($fortress->getId(), $this->fortressOptions->getDisable())) { continue; } $fortressFilterList[] = $fortress; } $viewModel = new ViewModel(['fortressGuildList' => $fortressFilterList]); $viewModel->setTemplate('p-server-sro/fortress'); return $this->getView()->render($viewModel); }
/** * @return null|\PServerCore\Entity\ServerInfo[] */ public function getServerInfo() { $serverInfo = $this->cachingHelperService->getItem(Caching::SERVER_INFO, function () { return $this->getServerInfoRepository()->getActiveInfoList(); }); return $serverInfo; }
/** * @return \PServerCore\Entity\DownloadList[] */ public function getActiveList() { $downloadInfo = $this->cachingHelperService->getItem(Caching::DOWNLOAD, function () { return $this->getDownloadRepository()->getActiveDownloadList(); }); return $downloadInfo; }
/** * @return int */ public function getCurrentPlayer() { $currentPlayer = $this->cachingHelperService->getItem(Caching::PLAYER_HISTORY, function () { /** @var \PServerCore\Entity\Repository\PlayerHistory $repository */ $repository = $this->entityManager->getRepository($this->collectionOptions->getEntityOptions()->getPlayerHistory()); return $repository->getCurrentPlayer(); }); return $currentPlayer; }
/** * @param int $limit * @return string */ public function __invoke($limit = 10) { $traderEntityData = $this->serviceCache->getItem('PServerSRORankingJobTraderInfo', function () use($limit) { return $this->rankingService->getTopTraderEntityData($limit); }, 180); $viewModel = new ViewModel(['jobList' => $traderEntityData]); $viewModel->setTemplate('p-server-sro/ranking-job-trader'); return $this->getView()->render($viewModel); }
/** * @param $type * * @return \PServerCore\Entity\PageInfo|null */ public function getPage4Type($type) { $cachingKey = Caching::PAGE_INFO . '_' . $type; $pageInfo = $this->cachingHelperService->getItem($cachingKey, function () use($type) { /** @var \PServerCore\Entity\Repository\PageInfo $repository */ $repository = $this->entityManager->getRepository($this->collectionOptions->getEntityOptions()->getPageInfo()); return $repository->getPageData4Type($type); }); return $pageInfo; }