Commit f11db174 authored by lixiaofang's avatar lixiaofang

最新tab修改

parent d064ecd6
...@@ -60,6 +60,7 @@ ...@@ -60,6 +60,7 @@
"type":"nested", "type":"nested",
"properties":{ "properties":{
"pictorial_id":{"type":"long"}, "pictorial_id":{"type":"long"},
"topic_add_time":{"type":"long"},
"real_vote_cnt":{"type":"long"}, "real_vote_cnt":{"type":"long"},
"virt_vote_cnt":{"type":"long"}, "virt_vote_cnt":{"type":"long"},
"total_vote_cnt":{"type":"long"} "total_vote_cnt":{"type":"long"}
......
...@@ -203,7 +203,7 @@ class Topic(models.Model): ...@@ -203,7 +203,7 @@ class Topic(models.Model):
tag_id_list = TopicTag.objects.using(settings.SLAVE_DB_NAME).filter(topic_id=self.id, tag_id_list = TopicTag.objects.using(settings.SLAVE_DB_NAME).filter(topic_id=self.id,
is_collection=1).values_list("tag_id", is_collection=1).values_list("tag_id",
flat=True) flat=True)
return list(tag_id_list) return list(tag_id_list)
except: except:
logging.error("catch exception,err_msg:%s" % traceback.format_exc()) logging.error("catch exception,err_msg:%s" % traceback.format_exc())
return [] return []
...@@ -282,26 +282,28 @@ class Topic(models.Model): ...@@ -282,26 +282,28 @@ class Topic(models.Model):
def get_related_billboard(self): def get_related_billboard(self):
try: try:
pictorial_ids = Topic.get_pictorial_id(self)
related_billboard_list = list() related_billboard_list = list()
for pictorial_id in pictorial_ids: pictorials = PictorialTopic.objects.filter(topic_id=self.id).values("pictorial_id", "create_time")
for pictorial_id in pictorials:
query_result = TopicBillBoard.objects.filter(pictorial_id=pictorial_id, query_result = TopicBillBoard.objects.filter(pictorial_id=pictorial_id.get('pictorial_id', None),
topic_id=self.id).values().first() topic_id=self.id).values().first()
if query_result == None: if query_result == None:
related_billboard_list.append({"pictorial_id": pictorial_id, "real_vote_cnt": 0, related_billboard_list.append(
"virt_vote_cnt": 0, "total_vote_cnt": 0}) {"pictorial_id": pictorial_id.get('pictorial_id', None), "real_vote_cnt": 0,
"virt_vote_cnt": 0, "total_vote_cnt": 0,
"topic_add_createtime": int(
time.mktime(pictorial_id.get("create_time", None).timetuple()))})
else: else:
total_vote_cnt = int(query_result["virt_vote_cnt"]) + int(query_result["real_vote_cnt"]) total_vote_cnt = int(query_result["virt_vote_cnt"]) + int(query_result["real_vote_cnt"])
related_billboard_list.append( related_billboard_list.append(
{"pictorial_id": query_result["pictorial_id"], "real_vote_cnt": query_result["real_vote_cnt"], {"pictorial_id": query_result["pictorial_id"], "real_vote_cnt": query_result["real_vote_cnt"],
"virt_vote_cnt": query_result["virt_vote_cnt"], "total_vote_cnt": total_vote_cnt}) "virt_vote_cnt": query_result["virt_vote_cnt"], "total_vote_cnt": total_vote_cnt,
"topic_add_createtime": int(time.mktime(pictorial_id.get("create_time", None).timetuple()))})
logging.info("product_brand_info" % related_billboard_list) logging.info("product_brand_info" % related_billboard_list)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment