getRapidEntrance (); // 头部导航"新建"数据 if($events_id){ $adminPublicArray ['EventsDefaultCode'] = $this->getEventsDefaultCode($events_id);//获取活动默认勾选列表后 "二维码" $adminPublicArray ['listDisplayDesc'] = LotteryEvents::getListDisplay(); // 活动列表中显示状态 } return $adminPublicArray; } /** * 头部导航"新建"数据 */ public function getRapidEntrance() { $url = Request::schemeDomain () . '/?c=Admin_Activity_SetBasics&a=PageCreate&type='; $fastCreateActivityUrlData = array ( '抽奖' => $url . LotteryEvents::TYPE_EVENTS_TURNTABLE . '&bigType=Event', '邀请函' => $url . LotteryEvents::TYPE_EVENTS_INVITATION . '&bigType=Event', '优惠券' => $url . LotteryEvents::TYPE_EVENTS_CODE . '&bigType=Event', '试用' => $url . LotteryEvents::TYPE_EVENTS_TRY . '&bigType=Event', '问卷调查' => $url . LotteryEvents::TYPE_EVENTS_SURVEY . '&bigType=Event', '投票' => $url . LotteryEvents::TYPE_EVENTS_VOTE . '&bigType=Event', '切屏专题' => $url . LotteryEvents::TYPE_EVENTS_CUT_SCREEN . '&bigType=H5', '文章' => $url . LotteryEvents::TYPE_EVENTS_ARTICLE . '&bigType=Article', '其他' => $url . LotteryEvents::TYPE_EVENTS_OTHER . '&bigType=Event', ); return $fastCreateActivityUrlData; } /** * 创建时的导航 * * @param string $type * @param string $bigType */ public function getCreatePageNav($type, $bigType) { $hostUrl = Request::schemeDomain (); $config = array ( 'Basics' => array ( 'show' => true, 'url' => $hostUrl . "/?c=Admin_Activity_SetBasics&a=PageCreate&type={$type}&bigType={$bigType}", 'name' => '基础设置', 'onClick' => true ), 'Interactive' => array ( 'name' => '互动设置' ), 'Page' => array ( 'name' => '页面制作' ), 'DeliveryChannels' => array ( 'name' => '投放渠道' ), 'Log' => array ( 'name' => '数据统计' ), 'UserLog' => array ( 'name' => '互动数据' ) ); if (in_array($type, array(4))) { $config['FeedBack'] = array ( 'name' => '用户反馈' ); } return $config; } /** * 修改时导航页面配置 * * @param int $event_id * @param int $type * @param string $this_nav_type * // 当前修改操作在哪个选项卡下 字符串 * @param int $display */ public function getUpPageNav($event_id, $this_nav_type) { $hostUrl = Request::schemeDomain (); $navArr = array ( 'Basics' => array ( 'show' => true, 'url' => $hostUrl . "/?c=Admin_Activity_SetBasics&a=PageShow&events_id={$event_id}", 'name' => '基础设置' ), 'Interactive' => array ( 'show' => true, 'url' => $hostUrl . "/?c=Admin_Activity_SetInteractive&a=PageShow&events_id={$event_id}", 'name' => '互动设置' ), 'Page' => array ( 'show' => true, 'url' => $hostUrl . "/?c=Admin_Activity_SetPage&a=PageShow&events_id={$event_id}", 'name' => '页面制作' ), 'DeliveryChannels' => array ( 'show' => true, 'url' => $hostUrl . "/?c=Admin_Activity_DeliveryChannels&a=PageList&events_id={$event_id}", 'name' => '投放渠道' ), 'Log' => array ( 'show' => true, 'url' => $hostUrl . "/?c=Admin_Activity_Log&a=PageList&events_id={$event_id}", 'name' => '数据统计' ), 'UserLog' => array ( 'show' => true, 'url' => $hostUrl . "/?c=Admin_Activity_UserParticipateLog&a=PageList&events_id={$event_id}&action=all", 'name' => '互动数据' ) ); $objDLotteryEvents = new LotteryEvents (); $eventData = $objDLotteryEvents->get ( $event_id ); $type = $eventData ['type']; if (in_array($type, array(4))) { $navArr['FeedBack'] = array ( 'show' => true, 'url' => $hostUrl . "/?c=Admin_Activity_FeedBack&a=PageList&events_id={$event_id}", 'name' => '用户反馈' ); } foreach ( $navArr as $key => $data ) { if ($key == $this_nav_type) { $navArr [$key] ['onClick'] = true; } } // 当前活动状态 是否设置完 if ($eventData ['display'] != LotteryEvents::EVENT_DISPLAY_UNFINISHED) { # 切屏专题 & 文章 特殊处理 $arr = array ( LotteryEvents::TYPE_EVENTS_ARTICLE, // LotteryEvents::TYPE_EVENTS_CODE, // LotteryEvents::TYPE_EVENTS_CUT_SCREEN, ); if (in_array ( $type, $arr )) { $navArr ['Interactive'] ['show'] = false; } # 其他专题 $arr = array ( LotteryEvents::TYPE_EVENTS_OTHER, ); if (in_array ( $type, $arr )) { $navArr ['Interactive'] ['show'] = false; $navArr['Page']['show'] = false; } return $navArr; } // 获取当前页面 设置到第几个选项卡了 前面&当前 选项卡都显示 $show = true; foreach ( $navArr as $key => $data ) { $navArr [$key] ['show'] = $show; if ($eventData ['setPageType'] == $key) { $show = false; } } // 当修改操作到了 最后三个操作 后续都 选项卡都显示 $showNavArr = array ( 'DeliveryChannels', 'Log', 'UserLog' ); if (in_array ( $this_nav_type, $showNavArr )) { foreach ( $showNavArr as $data ) { $navArr [$data] ['show'] = true; } } // 更具当前活动类型 // 永远不显示互动设置的类型 文章 ,专题 $arr = array ( LotteryEvents::TYPE_EVENTS_CUT_SCREEN, LotteryEvents::TYPE_EVENTS_ARTICLE ); if (in_array ( $type, $arr )) { $navArr ['Interactive'] ['show'] = false; } // 其余活动 $arr = array ( LotteryEvents::TYPE_EVENTS_TURNTABLE, LotteryEvents::TYPE_EVENTS_SCRATCH, LotteryEvents::TYPE_EVENTS_LETTERS, LotteryEvents::TYPE_EVENTS_TRY, LotteryEvents::TYPE_EVENTS_SURVEY, LotteryEvents::TYPE_EVENTS_VOTE, LotteryEvents::TYPE_EVENTS_INVITATION, LotteryEvents::TYPE_EVENTS_CODE, LotteryEvents::TYPE_EVENTS_CUT_SCREEN, ); if (in_array ( $type, $arr )) { $navArr ['Interactive'] ['show'] = true; $navArr ['Page'] ['show'] = true; } # 切屏专题 & 文章 特殊处理 $arr = array ( LotteryEvents::TYPE_EVENTS_ARTICLE, LotteryEvents::TYPE_EVENTS_CODE, ); if (in_array ( $type, $arr )) { $navArr ['Interactive'] ['show'] = false; } # 其他专题 $arr = array ( LotteryEvents::TYPE_EVENTS_OTHER, ); if (in_array ( $type, $arr )) { $navArr ['Interactive'] ['show'] = false; $navArr['Page']['show'] = false; } return $navArr; } /** * 获取活动默认勾选列表后 "二维码" */ public function getEventsDefaultCode($events_id){ $objDLotteryEvents = new LotteryEvents (); $objLottery = new Lottery(); $objDPlatform = new Platform(); $objDLotteryDeliveryChannels = new LotteryDeliveryChannels(); $thisPlatFormUrlData = array(); $eventsData = $objDLotteryEvents -> get($events_id); $platform_ids = $eventsData['platform_ids']; $allPlatformData = $objDPlatform -> getsAll(); foreach($allPlatformData as $id=> $platform){ if($platform_ids&$id){ $thisPlatFormUrlData[$id] = array(); $thisPlatFormUrlData[$id]['name'] = $platform['name']; $url = $objLottery->getEventsUrl($eventsData['type'],$eventsData['create_time'],$platform['url']); $thisPlatFormUrlData[$id]['url'] = $url; $t = $objDLotteryDeliveryChannels->getDefaultEventOnePV(Request::schemeDomain(),$events_id,$id); if (strstr($t, '||')) { $temp = explode('||', $t); $pv = $temp[0]; $time = $temp[1]; } else { $pv = $t; $time = false; } $thisPlatFormUrlData[$id]['time'] = $time; $thisPlatFormUrlData[$id]['pv'] = $pv; $thisPlatFormUrlData[$id]['img'] = $this->getImgCodePath($thisPlatFormUrlData[$id]['url']); } } //$thisPlatFormUrlData = array_pop($thisPlatFormUrlData); return $thisPlatFormUrlData; } /** * 设置当前修改完成,到哪个页面 * $event_id 活动ID * $this_nav_type 当前页面的名称 见数组 $navArr Basics,Interactive ,Page */ public function setNowUpPage($event_id, $this_nav_type) { $info ['setPageType'] = $this_nav_type; $objDLotteryEvents = new LotteryEvents (); $objDLotteryEvents->modify ( $info, array ( 'id' => $event_id ) ); return $event_id; } /** * 返回已创建Url二维码图片 * return imgUrl */ public function getImgCodePath($url) { $App_Path = Config::getInstance ()->get ( 'App_Path' ); $uploadConfig = Config::getInstance ()->get ( 'upload' ); $IMG_UPLOAD_URL = $uploadConfig ['url'] . DS . 'qrcode'; $filename = md5 ( $url ) . '.png'; $imgUrl = $IMG_UPLOAD_URL . DS . $filename; return $imgUrl; } /** * 创建URl 二维码 图片 */ public function createImgCodeUrl($url) { $App_Path = Config::getInstance ()->get ( 'App_Path' ); include_once $App_Path . DS . 'include/phpqrcode/phpqrcode.php'; $uploadConfig = Config::getInstance ()->get ( 'upload' ); $IMG_UPLOAD_PATH = $uploadConfig ['path'] . DS . 'qrcode'; $IMG_UPLOAD_URL = $uploadConfig ['url'] . DS . 'qrcode'; if (! file_exists ( $IMG_UPLOAD_PATH )) { if (! mkdir ( $IMG_UPLOAD_PATH, 0775, true )) { self::fail_exit ( '创建二维码失败,原因:图片目录不存在' ); } } $imgname = md5 ( $url ); $filename = $imgname . '.png'; \QRcode::png ( $url, $IMG_UPLOAD_PATH . DS . $filename, 3, 6 ); $imgUrl = $IMG_UPLOAD_URL . DS . $filename; return $imgUrl; } }