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


PHP Stats::calcStats方法代码示例

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


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

示例1: execute

 public function execute($nick, $uhost, $channel, $command, $parameters, $nickAccessLevel)
 {
     if (Util::isMaintenanceMode()) {
         irc_error("|r|Cannot reprice while in maintenance mode");
     }
     @($killID = (int) $parameters[0]);
     if ($killID == 0) {
         irc_error("|r|Please provide a valid killID.");
     }
     $count = Db::queryField("select count(*) count from zz_participants where killID = :killID", "count", array(":killID" => $killID));
     if ($count == 0) {
         irc_error("|r|KillID {$killID} does not exist!");
     }
     Stats::calcStats($killID, false);
     Db::execute("update zz_killmails set processed = 0 where killID = :killID", array(":killID" => $killID));
     do {
         sleep(1);
         $processed = Db::queryField("select processed from zz_killmails where killID = :killID", "processed", array(":killID" => $killID), 0);
     } while ($processed == 0);
     $kill = Db::queryRow("select * from zz_participants where isVictim = 1 and killID = :killID", array(":killID" => $killID), 0);
     $total = $kill["total_price"];
     $points = $kill["points"];
     irc_out("|g|{$killID}|n| repriced to|g| " . number_format($total, 2) . "|n| ISK and |g|" . number_format($points, 0) . "|n| points");
 }
开发者ID:Covert-Inferno,项目名称:zKillboard,代码行数:24,代码来源:irc_reprice.php

示例2: cleanDupe

 public static function cleanDupe($mKillID, $killID)
 {
     Db::execute("update zz_killmails set processed = 2 where killID = :mKillID", array(":mKillID" => $mKillID));
     Db::execute("update zz_manual_mails set killID = :killID where mKillID = :mKillID", array(":killID" => $killID, ":mKillID" => -1 * $mKillID));
     Stats::calcStats($mKillID, false);
     // remove manual version from stats
 }
开发者ID:Covert-Inferno,项目名称:zKillboard,代码行数:7,代码来源:Kills.php

示例3: deleteKill

 public static function deleteKill($killID)
 {
     if ($killID < 0) {
         // Verify the kill exists
         $count = Db::execute("select count(*) count from zz_killmails where killID = :killID", array(":killID" => $killID));
         if ($count == 0) {
             return false;
         }
         // Remove it from the stats
         Stats::calcStats($killID, false);
         // Remove it from the kill tables
         Db::execute("delete from zz_participants where killID = :killID", array(":killID" => $killID));
         // Mark the kill as deleted
         Db::execute("update zz_killmails set processed = 2 where killID = :killID", array(":killID" => $killID));
         return true;
     }
     return false;
 }
开发者ID:Covert-Inferno,项目名称:zKillboard,代码行数:18,代码来源:Util.php

示例4: parseKills

 public static function parseKills()
 {
     if (Util::isMaintenanceMode()) {
         return;
     }
     $timer = new Timer();
     $maxTime = 65 * 1000;
     Db::execute("set session wait_timeout = 120000");
     Db::execute("create temporary table if not exists zz_participants_temporary select * from zz_participants where 1 = 0");
     $numKills = 0;
     while ($timer->stop() < $maxTime) {
         if (Util::isMaintenanceMode()) {
             self::removeTempTables();
             return;
         }
         Db::execute("delete from zz_participants_temporary");
         //Log::log("Fetching kills for processing...");
         $result = Db::query("select * from zz_killmails where processed = 0 order by killID desc limit 100", array(), 0);
         if (sizeof($result) == 0) {
             $currentSecond = (int) date("s");
             $sleepTime = max(1, 15 - $currentSecond % 15);
             sleep($sleepTime);
             continue;
         }
         //Log::log("Processing fetched kills...");
         $processedKills = array();
         $cleanupKills = array();
         foreach ($result as $row) {
             $numKills++;
             $kill = json_decode($row['kill_json'], true);
             if (!isset($kill["killID"])) {
                 Log::log("Problem with kill " . $row["killID"]);
                 Db::execute("update zz_killmails set processed = 2 where killid = :killid", array(":killid" => $row["killID"]));
                 continue;
             }
             $killID = $kill["killID"];
             Db::execute("insert ignore into zz_killid values(:killID, 0)", array(":killID" => $killID));
             // Cleanup if we're reparsing
             $cleanupKills[] = $killID;
             // Do some validation on the kill
             if (!self::validKill($kill)) {
                 Db::execute("update zz_killmails set processed = 3 where killid = :killid", array(":killid" => $row["killID"]));
                 continue;
             }
             $totalCost = 0;
             $itemInsertOrder = 0;
             $totalCost += self::processItems($kill, $killID, $kill["items"], $itemInsertOrder);
             $totalCost += self::processVictim($kill, $killID, $kill["victim"], false);
             foreach ($kill["attackers"] as $attacker) {
                 self::processAttacker($kill, $killID, $attacker, $kill["victim"]["shipTypeID"], $totalCost);
             }
             $points = Points::calculatePoints($killID, true);
             Db::execute("update zz_participants_temporary set points = :points, number_involved = :numI, total_price = :tp where killID = :killID", array(":killID" => $killID, ":points" => $points, ":numI" => sizeof($kill["attackers"]), ":tp" => $totalCost));
             $processedKills[] = $killID;
         }
         if (sizeof($cleanupKills)) {
             Db::execute("delete from zz_participants where killID in (" . implode(",", $cleanupKills) . ")");
         }
         Db::execute("insert into zz_participants select * from zz_participants_temporary");
         if (sizeof($processedKills)) {
             Db::execute("update zz_killmails set processed = 1 where killID in (" . implode(",", $processedKills) . ")");
         }
         foreach ($processedKills as $killID) {
             Stats::calcStats($killID, true);
             // Add points and total value to the json stored in the database
             $raw = Db::queryField("select kill_json from zz_killmails where killID = :killID", "kill_json", array(":killID" => $killID), 0);
             $json = json_decode($raw, true);
             unset($json["_stringValue"]);
             unset($json["zkb"]);
             $stuff = Db::queryRow("select * from zz_participants where killID = :killID and isVictim = 1", array(":killID" => $killID), 0);
             if ($stuff != null) {
                 $zkb = array();
                 $zkb["totalValue"] = $stuff["total_price"];
                 $zkb["points"] = $stuff["points"];
                 $json["zkb"] = $zkb;
             }
             $raw = json_encode($json);
             Db::execute("update zz_killmails set kill_json = :raw where killID = :killID", array(":killID" => $killID, ":raw" => $raw));
         }
     }
     if ($numKills > 0) {
         Log::log("Processed {$numKills} kills");
     }
     self::removeTempTables();
 }
开发者ID:Covert-Inferno,项目名称:zKillboard,代码行数:85,代码来源:Parser.php


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