Exemple #1
0
	def feed_get_bbs_list(req,order,offset,limit):
		#最大取得数
		if(limit>100):
			limit=100

		#キャッシュが有効かどうか
		cache_enable=0
		if(offset==0):
			cache_enable=1
		
		#キャッシュ取得
		cache_id=BbsConst.OBJECT_CACHE_HEADER+BbsConst.OBJECT_BBS_RANKING_HEADER
		if(cache_enable):
			data=memcache.get(cache_id)
		else:
			data=None
		if(data and cache_enable):
			dic=[]
			for bbs in data:
				dic.append(ApiObject.create_bbs_object(req,bbs))
			return dic
		
		#BBS一覧取得
		rank=Ranking.get_by_key_name(BbsConst.THREAD_RANKING_KEY_NAME)
		if(rank==None):
			rank=Ranking.get_or_insert(BbsConst.THREAD_RANKING_KEY_NAME)
		bbs_list=rank.get_bbs_rank(offset,limit)
		
		#リスト作成
		bbs_list=ApiObject.get_cached_object_list(bbs_list)

		#キャッシュに乗せる
		if(cache_enable):
			memcache.set(cache_id,bbs_list,BbsConst.TOPPAGE_FEED_CACHE_TIME)

		#オブジェクト作成
		dic=[]
		for bbs in bbs_list:
			dic.append(ApiObject.create_bbs_object(req,bbs))
		
		return dic
Exemple #2
0
	def user_get_bbs_list(req,user_id):
		query=db.Query(Bbs,keys_only=True)
		query=query.filter("user_id =",user_id).order("-create_date")
		bbs_key_list=query.fetch(limit=1000,offset=0)
		dic=[]
		bbs_list=ApiObject.get_cached_object_list(bbs_key_list)
		for bbs in bbs_list:
			if(bbs.del_flag):
				continue
			one_dic=ApiObject.create_bbs_object(req,bbs)
			if(not one_dic):
				continue
			dic.append(one_dic)
		return dic;
Exemple #3
0
	def _bookmark_get_bbs_list_core(req,user_id,mute):
		bookmark=ApiObject.get_bookmark_of_user_id(user_id)
		if(bookmark==None):
			return []
		dic=[]
		if(mute):
			bbs_key_list=bookmark.get_mute_bbs_list()
		else:
			bbs_key_list=bookmark.bbs_key_list
		bbs_list=ApiObject.get_cached_object_list(bbs_key_list)
		for bbs in bbs_list:
			one_dic=ApiObject.create_bbs_object(req,bbs)
			if(one_dic):
				dic.append(one_dic)
		
		ApiBookmark.add_removed_bbs_to_dic(req,dic,bbs_key_list)

		return dic