当前位置: 首页>>代码示例>>PHP>>正文


PHP Team::initById方法代码示例

本文整理汇总了PHP中Team::initById方法的典型用法代码示例。如果您正苦于以下问题:PHP Team::initById方法的具体用法?PHP Team::initById怎么用?PHP Team::initById使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Team的用法示例。


在下文中一共展示了Team::initById方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: action

 public function action()
 {
     $team = new Team();
     $team->initById($this->parameters->teamId);
     $teamInJSON = JSONPrepare::team($team);
     $teamInJSON["footballers"] = JSONPrepare::footballers(FootballerSatellite::initForTeam($team));
     $teamInJSON["sponsors"] = JSONPrepare::sponsors(SponsorSatellite::initForTeam($team));
     $this->result['team'] = $teamInJSON;
 }
开发者ID:rootree,项目名称:vk-footboller-server,代码行数:9,代码来源:TeamProfileController.php

示例2: action

 public function action()
 {
     $groupType = intval($this->parameters->groupType);
     $placerId = intval($this->parameters->placerId);
     if ($groupType == 0 || $groupType == TOUR_TYPE_VK && $placerId != 0) {
         return new ErrorPoint(ErrorPoint::CODE_LOGIC, "Ошибка в программе", ErrorPoint::TYPE_USER);
     }
     track_stats();
     // Отслеживаем производительность
     $sql_template = "SELECT vk_id, wins, ties, loses, score, group_number, in_play_off, tour_group_id FROM tour_groups WHERE was_closed = 0 and tour_type = %d and tour_placer_id = %d;";
     $sql = sprintf($sql_template, $groupType, $placerId);
     $SQLresult = SQL::getInstance()->query($sql);
     if ($SQLresult instanceof ErrorPoint) {
         return $SQLresult;
     }
     $group = array();
     track_stats();
     // Отслеживаем производительность
     if ($SQLresult->num_rows) {
         while ($teamObject = $SQLresult->fetch_object()) {
             $group[$teamObject->group_number][] = $teamObject;
             $team = new Team();
             $team->initById($teamObject->vk_id);
             $teamInJSON = JSONPrepare::team($team);
             $this->result['teams'][] = $teamInJSON;
             if ($teamObject->vk_id == $this->teamProfile->getSocialUserId()) {
                 $this->userInGroups = array($teamObject->tour_group_id, $teamObject->group_number);
                 if ($teamObject->in_play_off) {
                     $this->userInPlayOff = true;
                 }
             }
         }
     }
     track_stats();
     // Отслеживаем производительность
     $this->result['group'] = $group;
     $playOff = array();
     $currentStep = 4;
     $playOff[$currentStep] = $this->getPlayOffByStep($currentStep, $groupType, $placerId);
     $currentStep--;
     $playOff[$currentStep] = $this->getPlayOffByStep($currentStep, $groupType, $placerId);
     $currentStep--;
     $playOff[$currentStep] = $this->getPlayOffByStep($currentStep, $groupType, $placerId);
     $currentStep--;
     $playOff[$currentStep] = $this->getPlayOffByStep($currentStep, $groupType, $placerId);
     $this->result['playOff'] = $playOff;
     track_stats();
     // Отслеживаем производительность
     $this->result['groupSteps'] = array();
     if ($this->userInGroups) {
         $sql_template = "SELECT finished, goals_enemy, goals, result, vk_id_enemy, vk_id, group_details_id FROM tour_groups_details WHERE tour_group_id = %d and vk_id = %d ORDER BY group_details_id ;";
         $sql = sprintf($sql_template, $this->userInGroups[0], $this->teamProfile->getSocialUserId());
         $SQLresult = SQL::getInstance()->query($sql);
         if ($SQLresult instanceof ErrorPoint) {
             return $SQLresult;
         }
         $finishedCounter = 0;
         if ($SQLresult->num_rows) {
             while ($groupStepObject = $SQLresult->fetch_object()) {
                 $this->result['groupSteps'][$groupStepObject->group_details_id] = $groupStepObject;
                 $this->result['groupSteps'][$groupStepObject->group_details_id]->group_number = $this->userInGroups[1];
                 $finishedCounter += $groupStepObject->finished;
             }
         }
         if ($finishedCounter == 3) {
             $this->result['groupSteps'] = array();
         }
     }
     track_stats();
     // Отслеживаем производительность
     $this->result['playOffSteps'] = array();
     if ($this->userInPlayOff) {
         $sql_template = "SELECT vk_id_enemy, result, goals, goals_enemy, finished, play_off_step, play_off_id FROM tour_play_off WHERE vk_id = %d and tour_type = %d and tour_placer_id = %d ORDER BY play_off_id ;";
         $sql = sprintf($sql_template, $this->teamProfile->getSocialUserId(), $groupType, $placerId);
         $SQLresult = SQL::getInstance()->query($sql);
         if ($SQLresult instanceof ErrorPoint) {
             return $SQLresult;
         }
         if ($SQLresult->num_rows) {
             while ($playOffStepObject = $SQLresult->fetch_object()) {
                 $this->result['playOffSteps'][$playOffStepObject->play_off_step] = $playOffStepObject;
             }
         }
     }
     track_stats();
     // Отслеживаем производительность
 }
开发者ID:rootree,项目名称:vk-footboller-server,代码行数:87,代码来源:GetTourController.php

示例3: intval

register_shutdown_function('shutdown');
set_error_handler("handlerError");
$userId = intval($_GET["userId"]);
$authKey = @trim($_GET["authKey"]);
$checkSum = @trim($_GET["checkSum"]);
$serverCheckSum = md5($authKey . SECRET_KEY . $userId);
if ($serverCheckSum != $checkSum) {
    $actionResult = new ErrorPoint(ErrorPoint::CODE_BAD_MD5, "WFT", ErrorPoint::TYPE_USER);
}
if (!in_array(getRealIP(), $allowIPForSystemCommand)) {
    $actionResult = new ErrorPoint(ErrorPoint::CODE_BAD_MD5, "WFT!: " . getRealIP(), ErrorPoint::TYPE_USER);
}
UserParameters::setUserId($userId);
if (SQL::getInstance()->connect_error) {
    $actionResult = new ErrorPoint(ErrorPoint::CODE_SQL, "Невозможно подключиться (" . SQL::getInstance()->connect_error . ")", ErrorPoint::TYPE_SYSTEM);
    break;
}
echo '<?xml version="1.0"?>
<userInfo>';
if (!array_key_exists("onlyProfile", $_GET)) {
    echo '<requests>';
    getUsersActivity();
    echo "</requests>";
}
$team = new Team();
$team->initById(UserParameters::getUserId());
echo "<team><![CDATA[" . json_encode(JSONPrepare::team($team)) . "]]></team>";
echo "</userInfo>";
ob_end_flush();
?>
 
开发者ID:rootree,项目名称:vk-footboller-server,代码行数:30,代码来源:userInfo.php

示例4: action

 public function action()
 {
     $detailId = 0;
     if (isset($this->parameters->detailId)) {
         $detailId = intval($this->parameters->detailId);
     }
     $typeTour = 0;
     if (isset($this->parameters->typeTour)) {
         $typeTour = intval($this->parameters->typeTour);
     }
     if ($this->teamProfile->getCurrentEnergy() < GlobalParameters::ENERGY_PER_MATCH) {
         return new ErrorPoint(ErrorPoint::CODE_SECURITY, "Для проведения новых матчей нужна энергия. На новый матч надо " . GlobalParameters::ENERGY_PER_MATCH, ErrorPoint::TYPE_USER);
     }
     track_stats();
     // Отслеживаем производительность
     $enemyTeam = new Team();
     $actionResult = $enemyTeam->initById($this->parameters->enemyTeamId);
     if ($actionResult instanceof ErrorPoint) {
         return $actionResult;
     }
     track_stats();
     // Отслеживаем производительность
     $isTourRun = isset($this->parameters->type) && $detailId && $typeTour;
     $this->result = JSONPrepare::footballers($enemyTeam->getFootballers());
     track_stats();
     // Отслеживаем производительность
     $this->result["healthDown"] = 0;
     $score1 = md5("1" . $this->parameters->enemyTeamId . SECRET_KEY);
     $score2 = md5("-1" . $this->parameters->enemyTeamId . SECRET_KEY);
     $score3 = md5("0" . $this->parameters->enemyTeamId . SECRET_KEY);
     $scoreTE = 0;
     $addonExperiance = GlobalParameters::EXPERIANCE_PER_MATCH_TIE;
     $addonMoney = GlobalParameters::MONEY_PER_MATCH_TIE;
     switch ($this->parameters->score) {
         case $score1:
             $scoreTE = 1;
             if (1 == rand(1, 100) && $this->teamProfile->getLevel() > 3) {
                 $this->result["healthDown"] = $this->healthDownFootballer();
             }
             $addonExperiance = GlobalParameters::EXPERIANCE_PER_MATCH;
             $addonMoney = GlobalParameters::MONEY_PER_MATCH;
             $this->teamProfile->increaseWonRating();
             if (!$isTourRun) {
                 $this->teamProfile->setTourIII($this->teamProfile->getTourIII() + 3);
             }
             break;
         case $score2:
             $scoreTE = -1;
             if (1 == rand(1, 30) && $this->teamProfile->getLevel() > 3) {
                 $this->result["healthDown"] = $this->healthDownFootballer();
             }
             $addonExperiance = GlobalParameters::EXPERIANCE_PER_MATCH_LOSE;
             $addonMoney = GlobalParameters::MONEY_PER_MATCH_LOSE;
             $this->teamProfile->increaseLoseRating();
             break;
         case $score3:
             if (1 == rand(1, 60) && $this->teamProfile->getLevel() > 5) {
                 $this->result["healthDown"] = $this->healthDownFootballer();
             }
             $addonExperiance = GlobalParameters::EXPERIANCE_PER_MATCH_TIE;
             $addonMoney = GlobalParameters::MONEY_PER_MATCH_TIE;
             $this->teamProfile->increaseTieRating();
             if (!$isTourRun) {
                 $this->teamProfile->setTourIII($this->teamProfile->getTourIII() + 1);
             }
             break;
     }
     track_stats();
     // Отслеживаем производительность
     $addonExperiance = $this->getAddOnXPorMoney($addonExperiance, $this->teamProfile->getLevel());
     $addonMoney = $this->getAddOnXPorMoney($addonMoney, $this->teamProfile->getLevel(), 10);
     $stadiumMoney = 0;
     if ($this->teamProfile->getStadiumId() && 1 == rand(1, 10)) {
         $stadiumMoney = $addonMoney * ($scoreTE + 2);
     }
     $stadiumMoney = $stadiumMoney < 10000 ? $stadiumMoney : 0;
     $addonExperiance = $addonExperiance < 10000 ? $addonExperiance : 0;
     $addonMoney = $addonMoney < 10000 ? $addonMoney : 0;
     $this->teamProfile->setEnergy($this->teamProfile->getCurrentEnergy() - GlobalParameters::ENERGY_PER_MATCH);
     $this->teamProfile->addExperience($addonExperiance);
     $this->teamProfile->setMoney($this->teamProfile->getMoney() + $addonMoney + $stadiumMoney);
     $this->result["stadiumBonus"] = $stadiumMoney;
     $this->result["addonEx"] = $addonExperiance;
     $this->result["addonMoney"] = $addonMoney;
     $this->result["currentEnergy"] = $this->teamProfile->getCurrentEnergy();
     $this->result["maxEnergy"] = $this->teamProfile->getEnergyMax();
     $this->result["score"] = $scoreTE;
     $this->result["bonus"] = null;
     $this->result["bonusTime"] = null;
     $this->result["totalBonus"] = null;
     track_stats();
     // Отслеживаем производительность
     $markAsFreeResult = TeamSatellite::increaseChooseRating($this->parameters->enemyTeamId);
     if ($markAsFreeResult instanceof ErrorPoint) {
         SQL::getInstance()->rollback();
         return $markAsFreeResult;
     }
     track_stats();
     // Отслеживаем производительность
     if ($isTourRun) {
//.........这里部分代码省略.........
开发者ID:rootree,项目名称:vk-footboller-server,代码行数:101,代码来源:MatchController.php


注:本文中的Team::initById方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。