<?php 
if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Count extends CI_Controller {

	function __construct(){
		parent::__construct();
	        $this->load->model('CsdjDB');
	        $this->load->model('CsdjAdmin');
	}

        //歌曲统计
	public function dance()
	{
            $ac=$this->input->get('ac', TRUE);

            $sql="select CS_ID from ".CS_SqlPrefix."dance  where CS_YID=0 and CS_HID=0";
            if($ac=='day'){
 		$sql.=" and DATEDIFF(DATE(CS_AddTime),'".date('Y-m-d')."')=0";
            }
            $result=$this->db->query($sql);
	    if($result){
		$count=$result->num_rows();
	    }else{
		$count="0";
	    }
            echo 'document.writeln("'.$count.'");';
	}

        //文章统计
	public function news()
	{
            $ac=$this->input->get('ac', TRUE);

            $sql="select CS_ID from ".CS_SqlPrefix."news  where CS_YID=0 and CS_HID=0";
            if($ac=='day'){
 		$sql.=" and DATEDIFF(DATE(CS_AddTime),'".date('Y-m-d')."')=0";
            }
            $result=$this->db->query($sql);
	    if($result){
		$count=$result->num_rows();
	    }else{
		$count="0";
	    }
            echo 'document.writeln("'.$count.'");';
	}

        //视频统计
	public function vod()
	{
            $ac=$this->input->get('ac', TRUE);

            $sql="select CS_ID from ".CS_SqlPrefix."vod  where CS_YID=0 and CS_HID=0";
            if($ac=='day'){
 		$sql.=" and DATEDIFF(DATE(CS_AddTime),'".date('Y-m-d')."')=0";
            }
            $result=$this->db->query($sql);
	    if($result){
		$count=$result->num_rows();
	    }else{
		$count="0";
	    }
            echo 'document.writeln("'.$count.'");';
	}

        //会员统计
	public function user()
	{
            $ac=$this->input->get('ac', TRUE);

            $sql="select CS_ID from ".CS_SqlPrefix."user  where CS_SID=0";
            if($ac=='day'){
 		$sql.=" and DATEDIFF(DATE(CS_AddTime),'".date('Y-m-d')."')=0";
            }
            $result=$this->db->query($sql);
	    if($result){
		$count=$result->num_rows();
	    }else{
		$count="0";
	    }
            echo 'document.writeln("'.$count.'");';
	}

        //专集统计
	public function topic()
	{
            $ac=$this->input->get('ac', TRUE);

            $sql="select CS_ID from ".CS_SqlPrefix."topic  where CS_YID=0";
            if($ac=='day'){
 		$sql.=" and DATEDIFF(DATE(CS_AddTime),'".date('Y-m-d')."')=0";
            }
            $result=$this->db->query($sql);
	    if($result){
		$count=$result->num_rows();
	    }else{
		$count="0";
	    }
            echo 'document.writeln("'.$count.'");';
	}

        //歌手统计
	public function singer()
	{
            $ac=$this->input->get('ac', TRUE);

            $sql="select CS_ID from ".CS_SqlPrefix."singer  where CS_YID=0";
            if($ac=='day'){
 		$sql.=" and DATEDIFF(DATE(CS_AddTime),'".date('Y-m-d')."')=0";
            }
            $result=$this->db->query($sql);
	    if($result){
		$count=$result->num_rows();
	    }else{
		$count="0";
	    }
            echo 'document.writeln("'.$count.'");';
	}
}

