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


PHP Historico::nativeQuery方法代码示例

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


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

示例1: recordes2

 public function recordes2($param)
 {
     $this->uses('Recorde');
     $recordes = array();
     $pos = array('MORTES_CONSECUTIVAS_PRO', 'MORTES_CONSECUTIVAS_CONTRA', 'DAMAGE_APLICADO', 'DAMAGE_RECEBIDO', 'PONTOS_DAMAGE', 'PONTOS_ARMOR', 'PONTOS_HP', 'PONTOS_MP', 'PONTOS_STRENGTH', 'PONTOS_AGILITY', 'PONTOS_INTELIGENCE', 'KILL_CREPS', 'KILL_NELTRALS', 'KILL_AOE', 'GOLD');
     $neg = array('TOWER');
     $oficial = 1;
     $sql = "SELECT h1.* FROM historico AS h1 " . "JOIN duelo AS d on h1.duelo = d.id " . "WHERE h1.tipoRecorde <> 'TOWER' " . ($oficial === NULL ? "" : "AND d.oficial = {$oficial} ") . "ORDER BY tipoRecorde, valor DESC";
     $results = Historico::nativeQuery($sql);
     $sql = "SELECT h1.* FROM historico AS h1 " . "JOIN duelo AS d on h1.duelo = d.id " . "WHERE tipoRecorde = 'TOWER' " . ($oficial === NULL ? "" : "AND d.oficial = {$oficial} ") . "ORDER BY tipoRecorde, valor ";
     $results = array_merge($results, Historico::nativeQuery($sql));
     $tipo = NULL;
     $limit = 3;
     $c = 0;
     foreach ($results as $r) {
         $r = new Recorde(array("dueloId" => $r->duelo, "posicao" => 1, "tipoRecorde" => $r->tipoRecorde, "valor" => $r->valor));
         //$r = new Recorde($r->duelo, 0, $r->tipoRecorde, $r->valor);
         if ($tipo != $r->getTipoRecorde()) {
             $recordes[$r->getTipoRecorde()] = array();
             $tipo = $r->getTipoRecorde();
             $c = 0;
         }
         //$recordes[$tipo][] = $r;
         if ($c > 0) {
             if (is_array($recordes[$tipo][$c - 1])) {
                 if ($r->getValor() == $recordes[$tipo][$c - 1][0]->getValor()) {
                     $r->setPosicao($c);
                     $recordes[$tipo][$c - 1][] = $r;
                     continue;
                 }
             } else {
                 if ($r->getValor() == $recordes[$tipo][$c - 1]->getValor()) {
                     $r->setPosicao($c);
                     $recordes[$tipo][$c - 1] = array($recordes[$tipo][$c - 1], $r);
                     continue;
                 }
             }
         }
         if ($c >= $limit) {
             continue;
         }
         $r->setPosicao($c + 1);
         $recordes[$tipo][] = $r;
         $c++;
     }
     return json_encode($recordes);
 }
开发者ID:rubensm1,项目名称:hist-dot,代码行数:47,代码来源:HistoricoController.php


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