<?php
/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * 流量统计首页
 *
 * @author yzxh24
 */
class IndexAction extends BaseAction
{
    public function run()
    {
		$criteria = new CDbCriteria();
        // 总流量
        $count = FluxLog::SumDay();

        // 手机流量
        $criteria->select = 'COUNT(1) AS count';
        $criteria->condition = 'valid = 1';
        $mobileCount = FluxLog::SumDay(null, $criteria);

        // 会员流量
        $criteria->condition = 'ismember = 1';
        $memberCount = FluxLog::SumDay(null, $criteria);

        // 会员手机流量
        $criteria->condition = 'ismember = 1 AND valid = 1';
        $memberMobileCount = FluxLog::SumDay(null, $criteria);

		$this->getController()->render('index', array(
            'count' => $count,
            'mobileCount' => $mobileCount,
            'memberCount' => $memberCount,
            'memberMobileCount' => $memberMobileCount,
        ));
    }
}
