objLottery = new Lottery (); $this->operatorData = $this->getUser (); $this->objDPlatform = new Platform(); $this->objDLotteryDeliveryChannels = new LotteryDeliveryChannels(); } public function doDefault() { } /** * 默认页面 * 获取所有渠道列表分页 * 地址:http://cas.lishuy.com/?c=Admin_Activity_DeliveryChannels&a=PageList&events_id= */ public function doPageList() { $events_id = Request::g('events_id'); $events_Data = $this->objLottery->getOneLotteryEventsAndPrize ( $events_id ); $platFormData = $this->objDPlatform -> getsAll(); # 获取当前活动都添加哪些 列表 # 返回列表IDs $platFormIds = array(); foreach($platFormData as $key => $data){ if($events_Data['platform_ids']&$key){ $platFormIds[$key] = $key; } } $page = Request::varGetInt ( 'page', 1 ); $size = 10; $offset = ($page - 1) * $size; $limit = "{$offset},{$size}"; $condition = array( 'events_id' => $events_id ); $total_num = $this->objDLotteryDeliveryChannels->totals ( $condition ); $url_tpl = Request::schemeDomain () . "?c=Admin_Activity_DeliveryChannels&a=PageList"; $url_tpl .= "?page={page}"; $objPage = new Page ( $total_num, $url_tpl, $page, $size ); $page_html = $objPage->html (); $order = 'id desc'; $ids = $this->objDLotteryDeliveryChannels->findIdsBy ( $condition, $limit, $order ); $deliveryChannelsData = $this->objDLotteryDeliveryChannels->gets ( $ids ); $eventsDisplayStatus = LotteryEvents::getDisplay (); // [活动] 是否显示 $objPlatform = new Platform(); $formData = $objPlatform -> getsAll(); foreach($deliveryChannelsData as $key => $data){ $deliveryChannelsData[$key]['url'] = $this->objLottery->getEventsUrl ($events_Data['events']['type'] , $events_Data['events']['create_time'] , $formData[$data['platform_id']]['url']).'/?from='.$key; $this->createImgCodeUrl($deliveryChannelsData[$key]['url']); $deliveryChannelsData[$key]['img_url'] = $this->getImgCodePath($deliveryChannelsData[$key]['url']); } # 获取默认PV $this->setOutput( 'platFormIds' ,$platFormIds); // 当前活动包含的平台 $this->setOutput ( 'platFormData', $platFormData ); // 当前所有平台列表信息 $this->setOutput ( 'page_html', $page_html ); // 分页Html $this->setOutput ( 'deliveryChannelsData', $deliveryChannelsData ); // 渠道信息数据 //公用内部导航信息 $navConfig = $this->getUpPageNav($events_id, 'DeliveryChannels'); $typeData = LotteryEvents::getType (); $this->setOutput ( 'navConfig', $navConfig ); $this->setOutput ( 'typeData', $typeData ); $this->setOutput ( 'eventData', $events_Data['events'] ); $this->setOutput ( 'eventsDisplayStatus', $eventsDisplayStatus ); $this->tpl = 'admin/activity/delivery_channels_list'; $title = '基础设置'; $this->setOutput('title', $title); $this->setOutput('menu_active', array('name' => 'mypublish', 'item' => '')); //激活菜单 $this->addNavMenu('活动列表'); $this->addNavMenu($title); $this->setOutput('displayDesc', LotteryEvents::getDisplay()); $this->setOutput('pagePublicData', $this->getPagePublicData($events_id)); // 后台管理相关数据 } /** * 页面: 添加渠道 * 地址:http://cas.lishuy.com/?c=Admin_Activity_DeliveryChannels&a=PageAddDeliveryChannels&events_id= */ public function doPageAddDeliveryChannels(){ $events_id = Request::g('events_id'); $events_Data = $this->objLottery->getOneLotteryEventsAndPrize ( $events_id ); $platFormData = $this->objDPlatform -> getsAll(); # 获取当前活动都添加哪些列表 $platFormIds = array(); foreach($platFormData as $key => $data){ if($events_Data['events']['platform_ids']&$key){ $platFormIds[$key] = $key; } } $this->setOutput ( 'platFormData', $platFormData ); $this->setOutput ( 'platFormIds', $platFormIds ); # 公用内部导航信息 $navConfig = $this->getUpPageNav($events_id, 'DeliveryChannels'); $typeData = LotteryEvents::getType (); $eventsDisplayStatus = LotteryEvents::getDisplay (); $this->setOutput ( 'navConfig', $navConfig ); $this->setOutput ( 'typeData', $typeData ); $this->setOutput ( 'eventData', $events_Data['events'] ); $this->setOutput ( 'eventsDisplayStatus', $eventsDisplayStatus ); $this->tpl = 'admin/activity/delivery_channels_add'; $title = '添加投放渠道'; $this->setOutput('title', $title); $this->setOutput('menu_active', array('name' => 'mypublish', 'item' => '')); //激活菜单 $this->addNavMenu('活动列表'); $this->addNavMenu($title); $this->setOutput('displayDesc', LotteryEvents::getDisplay()); $this->setOutput('pagePublicData', $this->getPagePublicData($events_id)); // 后台管理相关数据 } /** * 事件: 添加渠道 * 地址:http://cas.lishuy.com/?c=Admin_Activity_DeliveryChannels&a=ReqAddDeliveryChannels */ public function doReqAddDeliveryChannels (){ $events_id = Request::p('events_id'); $platform_id_str = Request::p('platform_ids_str'); $str_name = Request::p('str_name'); $platform_ids = explode('|', $platform_id_str); foreach($platform_ids as $key => $platform_id){ if($platform_id){ $info = array( 'events_id' => $events_id, 'platform_id' => $platform_id, 'str_name' => $str_name, 'perator_uid' => $this->doperatorData['uid'], ); $this->objDLotteryDeliveryChannels -> add($info); }else{ unset($platform_ids[$key]); } } if(empty($platform_ids)){ $info = array( 'events_id' => $events_id, 'platform_id' => 0, 'str_name' => $str_name, 'perator_uid' => $this->doperatorData['uid'], ); $this->objDLotteryDeliveryChannels -> add($info); } $this->ajax_success_exit('ok'); } /** * 事件 : 修改 * 地址:http://cas.lishuy.com/?c=Admin_Activity_DeliveryChannels&a=ReqUp * 参数见方法 */ public function doReqUp(){ $delivery_channels_id = Request::p('delivery_channels_id'); $str_name = Request::p('str_name'); $info = array( 'str_name' => $str_name, ); $condition = array( 'id' => $delivery_channels_id ); $this->objDLotteryDeliveryChannels -> modify($info,$condition); // TODO 根据前端自定义返回结果或跳转 return ''; } public function display() { return $this->render (); } }