コード例 #1
0
ファイル: StatController.php プロジェクト: lilhorse/cocoa
 public function indexAction()
 {
     header('Pragma: ');
     header("cache-control: s-maxage=600");
     $statModel = new StatModel();
     $day = 10;
     $regUsersTrend = $statModel->recentRegUsersTrend($day);
     $this->_mainContent->assign("regUsersTrend", $regUsersTrend);
     $recentRegUsersTrendAll = $statModel->recentRegUsersTrendAll($day);
     $this->_mainContent->assign("recentRegUsersTrendAll", $recentRegUsersTrendAll);
     $activeUsersTrend = $statModel->activeUsersTrend($day);
     $this->_mainContent->assign("activeUsersTrend", $activeUsersTrend);
     $threadTrend = $statModel->recentThreadTrend($day);
     $this->_mainContent->assign("threadTrend", $threadTrend);
     $replyTrend = $statModel->recentReplysTrend($day);
     $this->_mainContent->assign("replyTrend", $replyTrend);
     $TrendTimer = $statModel->threadTimerTrend($day);
     $this->_mainContent->assign("TrendTimer", $TrendTimer);
     $replyTimer = $statModel->replysTimerTrend($day);
     $this->_mainContent->assign("replyTimer", $replyTimer);
     $stats = $statModel->stats();
     $this->_mainContent->assign("stats", $stats);
     $this->display();
 }
コード例 #2
0
ファイル: Stat.php プロジェクト: VictorSproot/AtomXCMS-2
 /**
  * @return object
  */
 public function getAuthor()
 {
     if (!$this->checkProperty('author')) {
         $Model = new StatModel('stat');
         $this->author = $Model->getAuthorByEntity($this);
         // TODO (function is not exists)
     }
     return $this->author;
 }
コード例 #3
0
 public function statAction()
 {
     $index = $this->strVal(3);
     $stat = new StatModel();
     $days = $stat->days();
     if (strlen($index) == 0) {
         $index = $days[0]["datename"];
     }
     $data = $stat->data($index);
     $time = explode(",", $data["time"]["content"]);
     $ipdata = $data["ip"]["content"];
     $iparray = explode("\n", $ipdata);
     $ips = array();
     foreach ($iparray as $ip) {
         $v = explode(" ", trim($ip));
         if (isset($v[0]) && isset($v[1])) {
             $ipline = array();
             $ipline["count"] = $v[0];
             $ipline["ip"] = $v[1];
             $ips[] = $ipline;
         }
     }
     $actiondata = $data["action"]["content"];
     $actionarray = explode("\n", $actiondata);
     $actions = array();
     foreach ($actionarray as $action) {
         $v = explode(" ", trim($action));
         if (isset($v[0]) && isset($v[1])) {
             $ipline = array();
             $ipline["count"] = $v[0];
             $ipline["action"] = $v[1];
             $actions[] = $ipline;
         }
     }
     $userdata = $data["user"]["content"];
     $userarray = explode("\n", $userdata);
     $users = array();
     foreach ($userarray as $user) {
         $v = explode(" ", trim($user));
         if (isset($v[0]) && isset($v[1])) {
             $ipline = array();
             $ipline["count"] = $v[0];
             $ipline["user"] = $v[1];
             $users[] = $ipline;
         }
     }
     $this->_mainContent->assign("time", $time);
     $this->_mainContent->assign("ips", $ips);
     $this->_mainContent->assign("actions", $actions);
     $this->_mainContent->assign("users", $users);
     $this->_mainContent->assign("index", $index);
     $this->_mainContent->assign("days", $days);
     $this->display();
 }
コード例 #4
0
ファイル: action.php プロジェクト: Resolut1on/My-Project
 protected function addCollect()
 {
     //验证是否登录
     $this->getLoginInfo();
     //验证token
     $this->checkToken(Utils::GetValue("tokenkey"), $this->uin);
     //检查请求来源
     $this->checkRefer();
     $collectionModel = new CollectionModel();
     $collectionList = $collectionModel->getUserCollectionList($this->uin);
     if ($collectionList === false) {
         echo '{"status":0}';
         exit;
     }
     $result = $collectionModel->addCollection($this->uin, $this->comicId);
     if ($result['ret'] == 2) {
         $statModel = new StatModel();
         $statModel->updStatByUinType($this->uin, COLL, count($collectionList) + 1);
         ActionHelper::UpdateComicStat($this->comicId, 'coll_count', '+');
         ActionHelper::RecordUserAction($this->uin, COLL_ACT, $this->comicId);
         ActionHelper::UpdateUserPoint($this->uin, COLL_ACT);
         echo '{"status":1}';
     } else {
         if ($result['code'] == -1) {
             echo '{"status":2}';
             exit;
         } else {
             if ($result['code'] == -2) {
                 echo '{"status":3}';
                 exit;
             } else {
                 echo '{"status":0}';
             }
         }
     }
 }