getEventsCreateTimeToId(); //$events_id = Request::g('events_id'); if (!Verify::unsignedInt($events_id)) { self::fail_exit('无效id'); } # 获取用户信息 $objUserData = new UserInfo(); $uid = $this->getRunTimeUid(); $userData = $objUserData -> get($uid); $this->setOutput('userData', $userData); # 获取转盘信息 & 8 个位置的奖品 $objLotteryEventsTypeTurntable = new LotteryEventsTypeTurntable($uid,$events_id); $turntableData = $objLotteryEventsTypeTurntable -> getEventsData(); # 检查是否移动端 $title = $turntableData['events']['weixinShare']['title'] ? $turntableData['events']['weixinShare']['title'] : $turntableData['events']['events_name']; //$this->checkIsFromMobile($title); # 获取试用信息 $objLotteryEventsTypeTry = new LotteryEventsTypeTry($uid, $events_id); $tryInfo = $objLotteryEventsTypeTry->getEventsData(); # 获取登录地址 $url = Request::g('url'); $plat_form_id = $this->getPlatFormId(); $objMLottery = new Lottery(); $thisUrl = $objMLottery -> getEventsUrl($turntableData['events']['type'],$turntableData['events']['create_time'],$url); $loginUrl = $this -> getLoginUrl($thisUrl); $this->setOutput('loginUrl', $loginUrl); # 判断是否需要登录 $ckLogin = $this->ckLogin(); $this->setOutput('ckLogin', $ckLogin); # 其他开始活动 $objDLottery = new Lottery(); $condition = array( 'display' => LotteryEvents::EVENT_DISPLAY_SHOW, 'id' => SqlHelper::addCompareOperator('!=', $events_id), 'begin_time' => SqlHelper::addCompareOperator('<', $thisTime), 'end_time' => SqlHelper::addCompareOperator('>', $thisTime) ); $otherEventsData = $objDLottery -> getLotteryEventsList($condition, 3, 'id desc'); # 检查当前活动是否需要登录 $authorize = $turntableData['events']['authorize']; if ($authorize && $loginUrl) { if($ckLogin==true){ //self::redirect($loginUrl); } } # 活动状态 $TIME = time(); $eventsStatus = false; if($TIME < $turntableData['events']['begin_time'] ){ $eventsStatus = 'STATUS_NOT_START'; } elseif ($TIME > $turntableData['events']['end_time']){ $eventsStatus = 'STATUS_HAS_END'; } elseif ($turntableData['events']['display'] == \Cas\Dao\LotteryEvents::EVENT_DISPLAY_HIDE) { //$eventsStatus = 'STATUS_HIDE'; //先注释了。此隐藏 之印象列表 } # 获取用户最新收货地址 $objDLotteryUserExpress = new LotteryUserExpress(); $userExpress = $objDLotteryUserExpress -> getUserExpress($uid); # 页面渲染所需JSON $jsonTurntableData = array(); foreach($turntableData['turntable_prizes'] as $key => $data){ if(is_array($data)){ $jsonTurntableData[$data['id']] = $key; }else{ $jsonTurntableData['NoPrize'] = $key; } } $this->info($turntableData['events']); # 记录PV UV日志 访问 $objCount = new Count(); $plat_form_id = $this->getPlatFormId(); $objCount->setPassLog( $events_id,$plat_form_id); # 视频播放 preg_match_all('/]+>/i', $turntableData['events']['events_tips'], $matches); if ($matches) foreach ($matches[0] as $key => $tmpMatch) { $tmp_new_video_html = ''; $turntableData['events']['events_tips'] = str_replace($tmpMatch, $tmp_new_video_html, $turntableData['events']['events_tips']); } $jsonTurntableData = json_encode($jsonTurntableData); $this->tpl = 'events_turntable'; $this->setOutput('title', $turntableData['events']['weixinShare']['title'] ? $turntableData['events']['weixinShare']['title'] : $turntableData['events']['events_name']); //print_r($turntableData);die; $this->setOutput('display', $turntableData['events']['list_display']); $this->setOutput('jsonTurntableData', $jsonTurntableData); $this->setOutput('turntableData', $turntableData); $this->setOutput('otherEventsData', $otherEventsData); $this->setOutput('eventsStatus', $eventsStatus); $this->setOutput('weixinShare', $turntableData['events']['weixinShare']); } /** * 转盘动作 */ public function doRotation() { # 获取转盘信息 $events_id = Request::g('events_id'); if (!Verify::unsignedInt($events_id)) { self::fail_exit('无效id'); } $uid = $this->getRunTimeUid(); $objLotteryEventsTypeTurntable = new LotteryEventsTypeTurntable($uid,$events_id); $turntableData = $objLotteryEventsTypeTurntable -> getEventsData(); # 检查当前活动是否需要登录 & 获取登录地址 $plat_form_id = $this->getPlatFormId(); $objPlatForm = new Platform(); $form = $objPlatForm -> get($plat_form_id); $url = $form['url']; $objMLottery = new Lottery(); $thisUrl = $objMLottery -> getEventsUrl($turntableData['events']['type'],$turntableData['events']['create_time'],$url); $loginUrl = $this -> getLoginUrl($thisUrl); $authorize = $turntableData['events']['authorize']; if ($authorize && $loginUrl) { $ckLogin = $this->ckLogin(); if($ckLogin==true){ self::ajax_fail_exit(array('url' =>$loginUrl)); } } $tmpLotteryData = $objLotteryEventsTypeTurntable ->sweepstakes(); if(!$tmpLotteryData -> isSuccess()){ self::ajax_fail_exit($tmpLotteryData->getData()); } $lotteryData = $tmpLotteryData -> getData(); $prize_id = $lotteryData['prize_id']; $thisPrizeData = array(); $thisPrizeData['prize_name'] = $turntableData['prize'][$prize_id]['prize_name']; $thisPrizeData['id'] = $prize_id; $thisPrizeData['lottery_data_id'] = $lotteryData['id']; $thisPrizeData['express'] = $turntableData['prize'][$prize_id]['express']; $thisPrizeData['img_url'] = $turntableData['prize'][$prize_id]['img_url']; $thisPrizeData['express'] = $turntableData['prize'][$prize_id]['express']; $thisPrizeData['type'] = $turntableData['prize'][$prize_id]['type']; $thisPrizeData['virtual_data'] = isset($lotteryData['virtual_data'])?$lotteryData['virtual_data']:''; self::ajax_success_exit($thisPrizeData); } public function display() { return $this->render(); } }