| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112 | <?php /** * 发送数据统计(每天) */require_once( ONU_ROOT . 'application/module/ctrl/Action.class.php');require_once ( ONU_ROOT . 'application/lib/data/adminAction.php');class Data_statis_adminAction extends Action{		public function __construct(){		parent::__construct();		if(empty($_SESSION['mds_user'])){			header("Location:/?a=index&m=admin_login");			exit();		}	}	//发送数据统计(每天)	public function index(){		$admin = new AdvertAdminAction();		$api_user = $_SESSION['API_USER'];		$api_key  = $_SESSION['API_KEY'];		$uid      = $_SESSION['user_infos']['id'];		$info     = $_REQUEST['info'];		$post_url = 'http://api.sendcloud.net/apiv2/statday/list';		$e_date = date('Y-m-d',strtotime("+1 day"));		$s_date = date("Y-m-d", strtotime("-30 day"));		$date_show    = trim($_REQUEST['date_show']);		if($date_show){			$date_array = explode("-",$_REQUEST['date_show']);			$BeginDate2 = $date_array[0];			$BeginDate2 = date('Y-m-d',strtotime($BeginDate2));			$EndDate = $date_array[1];			$EndDate = date('Y-m-d',strtotime($EndDate));		}		$start_date = $BeginDate2 ? $BeginDate2 : $s_date;		$end_date   = $EndDate ? $EndDate : $e_date;		$B = date('Y/m/d',strtotime($start_date));		$e = date('Y/m/d',strtotime($end_date));		$date_show = $B.'-'.$e;		$params = array(					'apiUser' => $api_user,					'apiKey'  => $api_key,					'apiUserList' => $api_user,					'startDate' => $start_date,					'endDate'   => $end_date		);		$result = make_curl($post_url,$params);		$list   = $result['info']['dataList'];		$list   = $this->listByDate($list);		$this->assign('list',$list);		$this->assign('date_show',$date_show);		$this->assign('info',$info);		$this->display("index.html");	}	//按时间排序	function listByDate($list,$desc){		if(empty($desc)){//降序			for($i=0; $i<count($list) ;$i++){				for($j=0; $j<$i; $j++){					if($list[$i]['sendDate'] > $list[$j]['sendDate']){						$temp = $list[$i];						$list[$i] = $list[$j];						$list[$j] = $temp;					}				}			}		}else{			for($i=0; $i<count($list) ;$i++){				for($j=0; $j<$i; $j++){					if($list[$i]['sendDate'] < $list[$j]['sendDate']){						$temp = $list[$i];						$list[$i] = $list[$j];						$list[$j] = $temp;					}				}			}		}		return $list;	}	// class   end}?>
 |