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


PHP Statistics::getData方法代码示例

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


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

示例1: actionUpdate

 public function actionUpdate()
 {
     $competitions = Competition::model()->findAllByAttributes(array('type' => Competition::TYPE_WCA), array('condition' => 'date < unix_timestamp() AND date > unix_timestamp() - 86400 * 20', 'order' => 'date ASC'));
     $wcaDb = intval(file_get_contents(dirname(__DIR__) . '/config/wcaDb'));
     $sql = "UPDATE `user` `u`\r\n\t\t\t\tINNER JOIN `registration` `r` ON `u`.`id`=`r`.`user_id`\r\n\t\t\t\tLEFT JOIN `competition` `c` ON `r`.`competition_id`=`c`.`id`\r\n\t\t\t\tLEFT JOIN `wca_{$wcaDb}`.`Results` `rs`\r\n\t\t\t\t\tON `c`.`wca_competition_id`=`rs`.`competitionId`\r\n\t\t\t\t\tAND `rs`.`personName`=CASE WHEN `u`.`name_zh`='' THEN `u`.`name` ELSE CONCAT(`u`.`name`, ' (', `u`.`name_zh`, ')') END\r\n\t\t\t\tSET `u`.`wcaid`=`rs`.`personId`\r\n\t\t\t\tWHERE `u`.`wcaid`='' and `r`.`competition_id`=%id%";
     $db = Yii::app()->db;
     $num = [];
     foreach ($competitions as $competition) {
         $num[$competition->id] = $db->createCommand(str_replace('%id%', $competition->id, $sql))->execute();
     }
     echo 'updated wcaid: ', array_sum($num), PHP_EOL;
     Yii::import('application.statistics.*');
     Yii::app()->cache->flush();
     $data = Statistics::getData(true);
     echo 'set results_statistics_data: ', $data ? 1 : 0, PHP_EOL;
 }
开发者ID:sunshy360,项目名称:cubingchina,代码行数:16,代码来源:WcaCommand.php

示例2: actionStatistics

 public function actionStatistics()
 {
     $name = $this->sGet('name');
     $names = array_map('ucfirst', explode('-', $name));
     $class = implode('', $names);
     $this->description = Yii::t('statistics', 'Based on the official WCA competition results, we generated several WCA statistics about Chinese competitions and competitors, which were regularly up-to-date.');
     if ($class !== '') {
         if (method_exists($this, $method = 'stat' . $class)) {
             $this->{$method}();
             Yii::app()->end();
         } else {
             throw new CHttpException(404);
         }
     }
     $data = Statistics::getData();
     extract($data);
     $this->pageTitle = array('Fun Statistics');
     $this->title = 'Fun Statistics';
     $this->setWeiboShareDefaultText('关于中国WCA官方比赛及选手成绩的一系列趣味统计', false);
     $this->render('statistics', array('statistics' => $statistics, 'time' => $time));
 }
开发者ID:sunshy360,项目名称:cubingchina,代码行数:21,代码来源:ResultsController.php


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