getEventsCreateTimeToId(); if (!Verify::unsignedInt($events_id)) { self::fail_exit('无效id'); } # 获取"切屏专题"信息 $objDLotteryEvents = new LotteryEvents(); $cutScreenInfo = $objDLotteryEvents -> get($events_id); # 检查是否移动端 $title = $cutScreenInfo['weixinShare']['title'] ? $cutScreenInfo['weixinShare']['title']: $cutScreenInfo['events_name']; $this->checkIsFromMobile($title); # 获取登录地址 $url = Request::g('url'); $plat_form_id = $this->getPlatFormId(); $objMLottery = new Lottery(); $thisUrl = $objMLottery -> getEventsUrl($cutScreenInfo['type'],$cutScreenInfo['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); # 检查当前活动是否需要登录 $authorize = $cutScreenInfo['authorize']; if ($authorize && $loginUrl) { if($ckLogin==true){ self::redirect($loginUrl); } } $objMLotteryLog = new LotteryLog($uid,$events_id); $other = array( '访问页面:' => '成功' ); $objMLotteryLog ->addUserParticipateLog($other); $this->tpl = 'events_cutscreen'; $this->setOutput('title', $cutScreenInfo['weixinShare']['title'] ? $cutScreenInfo['weixinShare']['title']: $cutScreenInfo['events_name']); $this->setOutput('cutScreenInfo', $cutScreenInfo); $pageData = $cutScreenInfo['pageData']; $waitLoadingImgs = array(); # 构造下页面图片的位置 foreach ($pageData as $tmpkey => $tmpData) { if ($tmpData['input_page']) { continue; } foreach ($tmpData['layers'] as $key => $tmpLayer) { $new_layer = $pageData[$tmpkey]['layers'][$key]; if ($new_layer['url']) { $new_layer['width'] = $tmpLayer['width'] / 2; $new_layer['height'] = $tmpLayer['height'] / 2; $waitLoadingImgs[] = $new_layer['url']; } if ($new_layer['video_url']) { $new_layer['width'] = $new_layer['video_width'] = $tmpLayer['video_width']; $new_layer['height'] = $new_layer['video_height'] = $tmpLayer['video_height']; } $style = ''; switch ($tmpLayer['position']) { case 'center': $margin_left = $new_layer['width'] / 2; $margin_top = $new_layer['height'] / 2; $style = "left:50%;top:50%;margin-left:-{$margin_left}px;margin-top:-{$margin_top}px;"; break; case 'up'; $margin_left = $new_layer['width'] / 2; $style = "left:50%;top:0%;margin-left:-{$margin_left}px;"; break; case 'down': $margin_left = $new_layer['width'] / 2; $style = "left:50%;bottom:6%;margin-left:-{$margin_left}px;"; break; case 'leftup': $style = "left:0%;top:0%;"; break; case 'leftdown': $style = "left:0%;bottom:0%;"; break; case 'rightup': $style = "right:0%;top:0%;"; break; case 'rightdown': $style = "right:0%;bottom:0%;"; break; } $new_layer['style'] = $style; $pageData[$tmpkey]['layers'][$key] = $new_layer; } if ($tmpData['bgimage_url']) { $waitLoadingImgs[] = $tmpData['bgimage_url']; } } # 记录PV UV日志 访问 $objCount = new Count(); $objCount->setPassLog( $events_id,$plat_form_id); $this->setOutput('weixinShare', $cutScreenInfo['weixinShare']); $this->setOutput('pageData', $pageData); $this->setOutput('waitLoadingImgs', json_encode($waitLoadingImgs)); $this->setOutput('forms', $cutScreenInfo['forms']); } /** * 表单提交 */ public function doSubmitForm() { $events_id = Request::g('events_id'); if (!Verify::unsignedInt($events_id)) { self::ajax_fail_exit('无效id'); } $uid = $this->getRunTimeUid(); $objDLotteryEvents = new LotteryEvents(); $cutScreenInfo = $objDLotteryEvents -> get($events_id); $forms = $cutScreenInfo['forms']; $formData = Filter::arrayfilter($_POST, true); $objLotteryEventsForms = new LotteryEventsForms(); $tmpVerifyResult = $objLotteryEventsForms->verifyFormData($forms, $formData); if (!$tmpVerifyResult->isSuccess()) { self::ajax_fail_exit($tmpVerifyResult->getData()); } $info = array_merge($formData, array('uid' => $uid, 'events_id' => $events_id)); if (!$objLotteryEventsForms->add($info)) { self::ajax_fail_exit('数据库操作失败'); } self::ajax_success_exit(); } /** * */ public function display() { return $this->render(); } }