Пример #1
0
 /**
  * @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);
 }
Пример #2
0
 /**
  * @return null|\PServerCore\Entity\ServerInfo[]
  */
 public function getServerInfo()
 {
     $serverInfo = $this->cachingHelperService->getItem(Caching::SERVER_INFO, function () {
         return $this->getServerInfoRepository()->getActiveInfoList();
     });
     return $serverInfo;
 }
Пример #3
0
 /**
  * @return \PServerCore\Entity\DownloadList[]
  */
 public function getActiveList()
 {
     $downloadInfo = $this->cachingHelperService->getItem(Caching::DOWNLOAD, function () {
         return $this->getDownloadRepository()->getActiveDownloadList();
     });
     return $downloadInfo;
 }
Пример #4
0
 /**
  * @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;
 }
Пример #5
0
 /**
  * @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);
 }
Пример #6
0
 /**
  * @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;
 }