public function getWallpaperProtocol($rows) { $arrAndroidWp = array(); foreach ($rows as $row) { $wp_protocol = new WallpaperProtocol(); $wp_protocol->setWallpaperType(0); $wp_protocol->setWallpaperRatio($this->_widget->width, $this->_widget->height); $wp_protocol->setAndroideskWallpaper($row, Protocol::YL_DOWNLOAD_CHANNEL_WIDGET); $widgeturl = $this->_widget->getWidgetUrl($row['id'], $row['cpid'], $row['small_url']); $wp_protocol->setWidgetUrl($widgeturl); array_push($arrAndroidWp, $wp_protocol); } return $arrAndroidWp; }
/** * 根据类型获取广告列表 * @param unknown_type $type */ private function _getAdverList($sql, $channel = 0, $adid = '') { $rows = $this->executeQuery($sql); if ($rows === false) { log::write("AndroidWallpaperDb::_getAdListByType():executeQuery() sql: " . $sql . "faled", "log"); return false; } $arr_android_wp_ad = array(); foreach ($rows as $row) { $wp_protocol = new WallpaperProtocol(); $wp_protocol->setProduct($this->_product); $wp_protocol->setAndroideskWallpaper($row, $channel, $adid); $wp_protocol->setWallpaperRatio($this->_width, $this->_height); array_push($arr_android_wp_ad, $wp_protocol); } return $arr_android_wp_ad; }
public function getBannerProtocol($rows, $nType = 0) { $arrBanner = array(); $coolxius = array(); foreach ($rows as $row) { $strBannerId = $row['bannerid']; if (!array_key_exists($strBannerId, $arrBanner)) { $banner = new BannerProtocol(); $banner->setBanner($row['bannerurl'], $row['bannername']); $arrBanner = $arrBanner + array($strBannerId => $banner); } if (!array_key_exists($row['cpid'], $arrBanner[$strBannerId]->bannerRes)) { $strWpId = $row['cpid']; $wp = new WallpaperProtocol(); $wp->setVercode($this->_nVercode); $wp->setWallpaper($row, $this->_nChannel); $arrBanner[$strBannerId]->setBannerRes($strWpId, $wp); } } $arr_coolxius = array(); foreach ($arrBanner as $key => $temBanner) { $temBanner = $temBanner->getProtocol($this->strType); array_push($arr_coolxius, $temBanner); } return $arr_coolxius; }