public function getReviewsByProgram($programid, $limit = 3, $offset = 0) { $key = 'PROGRAM_REVIEW_LIST_PROD_ID' . $programid . '_LIMIT_' . $limit . '_OFFSET_' . $offset; $lists = CacheManager::getValueFromCache($key); if ($lists) { return $lists; } $lists = Yii::app()->db->createCommand()->select('id as review_id, comment_title as title, comments ,douban_comment_id as douban_review_id,create_date as create_date ')->from($this->tableName())->where('status=:status and content_id=:prod_id and comment_type=1', array(':status' => Constants::OBJECT_APPROVAL, ':prod_id' => $programid))->order('create_date DESC')->limit($limit)->offset($offset)->queryAll(); if (count($lists) > 0) { $prodExpired = CacheManager::getExpireByCache(CacheManager::CACHE_PARAM_EXPIRED_POPULAR_PROGRAM); CacheManager::setValueToCache($key, $lists, $prodExpired); } return $lists; }
public static function listSohuProduce($top_id, $limit, $offset) { $device = IjoyPlusServiceUtils::getDevice(); $where = ''; if ($device === false) { $key = SearchManager::CACHE_LIST_ITEMS_BY_TYPE_LIMIT_OFFSET . '_SohuProduce_' . $top_id . '_LIMIT_' . $limit . '_OFFSET_' . $offset; } else { $where = ' AND (can_search_device like \'%' . $device . '%\' or can_search_device is null or can_search_device =\'\' ) '; $key = SearchManager::CACHE_LIST_ITEMS_BY_TYPE_LIMIT_OFFSET . '_SohuProduce_' . $top_id . '_LIMIT_' . $limit . '_OFFSET_' . $offset . '_DEVICE_' . $device; } if (IjoyPlusServiceUtils::isExcludeCopyMovie()) { $where = $where . " and vod.d_area not like '%美国%' "; } $items = CacheManager::getValueFromCache($key); if ($items) { return $items; } $items = Yii::app()->db->createCommand()->select('vod.d_id as prod_id,vod.d_name as prod_name,vod.d_playfrom as sources,vod.d_level as definition, vod.d_type as prod_type, substring_index( vod.d_pic, \'{Array}\', 1 ) as prod_pic_url, substring_index( vod.d_pic_ipad, \'{Array}\', 1 ) as big_prod_pic_url, vod.d_content as prod_summary,vod.d_starring as star,vod.d_directed as director ,vod.d_score as score,vod.favority_user_count as favority_num ,vod.good_number as support_num ,vod.d_year as publish_date,vod.d_area as area, vod.d_remarks as max_episode, vod.d_state as cur_episode , vod.duraning as duration ')->from('mac_vod_topic_items as items')->join("mac_vod as vod", "items.vod_id=vod.d_id")->where('items.flag=:t_flag and items.topic_id=:topic_id and vod.d_hide=0 ' . $where, array(':t_flag' => 1, ':topic_id' => $top_id))->order('items.disp_order desc, vod.d_level desc ,vod.d_good desc,vod.d_time DESC ')->limit($limit)->offset($offset)->queryAll(); if (isset($items) && !is_null($items)) { $prodExpired = CacheManager::getExpireByCache(CacheManager::CACHE_PARAM_EXPIRED_POPULAR_PROGRAM); CacheManager::setValueToCache($key, $items, $prodExpired); } return $items; }
public static function getProgramTypeCache($prod_type) { $key = CacheManager::CACHE_PROD_TYPE_BY_PROD_ID . '_' . $prod_type; $prodType = CacheManager::getValueFromCache($key); if ($prodType) { return $prodType; } $prodType = MacVodType::model()->findByPk($prod_type); if (isset($prodType) && !is_null($prodType)) { CacheManager::setValueToCache($key, $prodType, 0); } return $prodType; }