| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495 | 
							- <?php
 
- namespace Cas\Controller;
 
- use Cas\Dao\LotteryEvents;
 
- use KIF\Core\Request;
 
- use KIF\Verify;
 
- use Cas\Module\LotteryLog;
 
- use Cas\Dao\UserInfo;
 
- use Cas\Module\Count;
 
- use Cas\Module\Lottery;
 
- /**
 
-  * 其他 活动
 
-  */
 
- class EventsOther extends EventsController {
 
- 	
 
- 	public function doDefault() {
 
- 		$thisTime = time();
 
- 		
 
- 		$events_id = $this->getEventsCreateTimeToId();
 
- 		//$events_id = Request::g('events_id');
 
- 		if (!Verify::unsignedInt($events_id)) {
 
- 			self::fail_exit('无效id');
 
- 		}
 
- 		
 
- 		# 获取“其他”信息
 
- 		$objDLotteryEvents = new LotteryEvents(); 
 
- 		$otherInfo = $objDLotteryEvents -> get($events_id);
 
- 		
 
- 		# 获取登录地址
 
- 		$url = Request::g('url');
 
- 		$plat_form_id = $this->getPlatFormId();
 
- 		$objMLottery  = new Lottery();
 
- 		$thisUrl  = $objMLottery -> getEventsUrl($otherInfo['type'],$otherInfo['create_time'],$url);
 
- 		$loginUrl = $this -> getLoginUrl($thisUrl);
 
- 		$this->setOutput('loginUrl', $loginUrl);
 
- 		# 判断是否需要登录
 
- 		$ckLogin = $this->ckLogin();
 
- 		$this->setOutput('ckLogin', $ckLogin);
 
- 		
 
- 		# 获取用户信息
 
- 		$objUserData = new UserInfo();
 
- 		$uid = $this->getRunTimeUid();
 
- 		$userData = $objUserData -> get($uid);
 
- 		$this->setOutput('userData', $userData);
 
- 		
 
- 		
 
- 		$eventsBeginOrEndState = array( 'show' => false);
 
- 		if($thisTime < $otherInfo['begin_time'] ){
 
- 			$eventsBeginOrEndState['show'] = true;
 
- 			$eventsBeginOrEndState['msg'] = '未开始';
 
- 		}
 
- 		if($thisTime > $otherInfo['end_time']){
 
- 			$eventsBeginOrEndState['show'] = true;
 
- 			$eventsBeginOrEndState['msg'] = '已结束';
 
- 			
 
- 		}
 
- 		if($thisTime > $otherInfo['begin_time'] && $thisTime < $otherInfo['end_time']){
 
- 			$eventsBeginOrEndState['show'] = false;
 
- 		}
 
- 		
 
- 		# 检查当前活动是否需要登录
 
- 		$authorize = $otherInfo['authorize'];
 
- 		if ($authorize && $loginUrl) {
 
- 				if($ckLogin==true){
 
- 					self::redirect($loginUrl);
 
- 				}
 
- 		}
 
- 		
 
- 		# 记录PV UV日志 访问
 
- 		$objCount = new Count();
 
- 		$objCount->setPassLog( $events_id,$plat_form_id);
 
- 		
 
- 		
 
- 		if(isset($otherInfo['other_url']) && !empty($otherInfo['other_url']) && !$eventsBeginOrEndState['show'] ){
 
- 			
 
- 			#######用户行为记录########
 
- 			#用户抽中奖品
 
- 			$objMLotteryLog = new LotteryLog($uid,$events_id);
 
- 			$other = array(
 
- 				'跳转页面:' => '成功'
 
- 			);
 
- 			$objMLotteryLog ->addUserParticipateLog($other);
 
- 			#########################
 
- 			
 
- 			header ( "Location: ".$otherInfo['other_url'] );
 
- 		}else{
 
- 			self::echo_404();
 
- 		}
 
- 		exit;
 
- 	}
 
- 	
 
- 	public function display() {
 
- 		return $this->render();
 
- 	}
 
- }
 
 
  |