| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127 | <?phpnamespace Cas\Controller\Admin\Activity;use Cas\Module\Lottery;use Cas\Dao\PlatformBulletin;use KIF\Core\Request;use Cas\Dao\LotteryEvents;use Cas\Controller\Admin\Controller;use Cas\Dao\Platform;use Cas\Dao\LotteryDeliveryChannels;use KIF\Core\Config;use Cas\Dao\LotteryPvUvLog;use KIF\Dao\SqlHelper;use KIF\Dao\AbstractDao;/** * "活动相关" - "数据统计" *  * @author lihuanchun  *           */class Log  extends Controller {	private $objLottery; // 活动后端	private $peratorData;		/**	 *  初始化	 */	public function __construct() {		header ( "Content-Type: text/html; charset=utf-8" );		$this->objLottery = new Lottery ();		$this->operatorData = $this->getUser ();			}		public function doDefault() {			}		/**	 * 默认页面	 * 获取所有渠道列表分页	 * 地址:页面: http://cas.lishuy.com/?c=Admin_Activity_Log&a=PageList&events_id=n	 */	public function doPageList() {				$events_id = Request::g('events_id');				$select = Request::g('select');		if ($select) {			$b_time = strtotime(date('Y-m-d', time() - $select*60*60*24));			$e_time = mktime(0,0,0) - 1;		} else {			$b_time = Request::g('b_time') ? strtotime(Request::g('b_time')) : strtotime(date('Y-m-d', time() - 7*60*60*24));			$e_time = Request::g('e_time') ? strtotime(Request::g('e_time')) : mktime(0,0,0) - 1;		}				$events_Data = $this->objLottery->getOneLotteryEventsAndPrize ( $events_id );		$objDLotteryPvUvLog = new LotteryPvUvLog();				$condition = array();		$condition ['events_id'] = $events_id;				$condition['date']	= SqlHelper::addCompareOperator('>=', $b_time);		$condition['`date`']	= SqlHelper::addCompareOperator('<', $e_time);				$logDataIds = $objDLotteryPvUvLog -> findIdsBy($condition);		$logData = $objDLotteryPvUvLog -> gets($logDataIds);				$pvs = $uvs = array();		foreach ($logData as $tmpLog) {			$pvs[date('j', $tmpLog['date'])] = $tmpLog['pv_num'];			$uvs[date('j', $tmpLog['date'])] = $tmpLog['uv_num'];		}				// 导航		$navConfig = $this->getUpPageNav($events_id, 'Log');		$eventsTypeData = LotteryEvents::getType (); // [活动] 类型				$this->tpl = 'admin/activity/statis';		$title = '数据统计';		$this->setOutput('title', $title);		$this->setOutput('menu_active', array('name' => 'mypublish', 'item' => '')); //激活菜单		$this->addNavMenu('活动列表');		$this->addNavMenu($title);				$this->setOutput ( 'navConfig', $navConfig );// 导航 显示 URL 配置		$this->setOutput('pagePublicData', $this->getPagePublicData($events_id)); // 后台管理相关数据		$this->setOutput('events_Data', $events_Data);		$this->setOutput('eventData', $events_Data['events']);		$this->setOutput('typeData', $eventsTypeData);		$this->setOutput('displayDesc', LotteryEvents::getDisplay());				$xAxis = array();		$i = 0;		do {			$x_time = $b_time + ($i*60*60*24);			if ($x_time > $e_time) {				break;			}						$tmpDay = date('j', $x_time);			$xAxis[$i] = $tmpDay;			$_pvs[$tmpDay] = $pvs[$tmpDay] ? $pvs[$tmpDay] : 0;			$_uvs[$tmpDay] = $uvs[$tmpDay] ? $uvs[$tmpDay] : 0;			$i++;		} while (true);				$this->setOutput('b_time', $b_time);		$this->setOutput('e_time', $e_time);		$this->setOutput('pvs', implode(',', $_pvs));		$this->setOutput('uvs', implode(',', $_uvs));		$this->setOutput('xAxis', implode(',', $xAxis));		$this->setOutput('logData', $logData);			}						public function display() {		return $this->render ();	}}	
 |