Commit 5e13f898 authored by lixiaofang's avatar lixiaofang

add

parent 2bc3df2e
...@@ -12,6 +12,9 @@ ...@@ -12,6 +12,9 @@
"icon":{"type":"text"}, "icon":{"type":"text"},
"high_quality_topic_num":{"type":"long"},//前一天该小组4&5星帖子数量 "high_quality_topic_num":{"type":"long"},//前一天该小组4&5星帖子数量
"create_time":{"type":"date", "format":"date_time_no_millis"}, "create_time":{"type":"date", "format":"date_time_no_millis"},
"update_time":{"type":"date", "format":"date_time_no_millis"} "update_time":{"type":"date", "format":"date_time_no_millis"},
"tag_id":{"type":"long"},
"tag_name":{"type":"long"}
} }
} }
\ No newline at end of file
...@@ -2,7 +2,10 @@ from django.db import models ...@@ -2,7 +2,10 @@ from django.db import models
import datetime import datetime
import logging import logging
import traceback import traceback
# from .topic import Topic
from .tag import Tag
from .topic import Topic
class PictorialTopic(models.Model): class PictorialTopic(models.Model):
"""画报帖子关系""" """画报帖子关系"""
...@@ -68,12 +71,53 @@ class Pictorial(models.Model): ...@@ -68,12 +71,53 @@ class Pictorial(models.Model):
logging.info("get topic_id_list:%s" % topic_id_list) logging.info("get topic_id_list:%s" % topic_id_list)
# topic_num = Topic.filter(content_level__in=("4", "5"), create_time__gte=yesterday_begin_time, topic_num = Topic.filter(content_level__in=("4", "5"), create_time__gte=yesterday_begin_time,
# create_time__lte=yesterday_end_time, topic_id_in=topic_id_list).count() create_time__lte=yesterday_end_time, topic_id_in=topic_id_list).count()
#
# logging.info("get topic_num:%s" % topic_num) logging.info("get topic_num:%s" % topic_num)
#
# return topic_num return topic_num
except:
logging.error("catch exception,err_msg:%s" % traceback.format_exc())
return False
class PictorialTag(models.Model):
"""画报关注标签"""
class Meta:
verbose_name = u"画报标签"
app_label = "community"
db_table = "community_pictorial_tag"
id = models.IntegerField(verbose_name=u'关注ID', primary_key=True)
create_time = models.DateTimeField(verbose_name=u'创建时间', default=datetime.datetime.fromtimestamp(0))
update_time = models.DateTimeField(verbose_name=u'更新时间', default=datetime.datetime.fromtimestamp(0))
pictorial_id = models.BigIntegerField(verbose_name=u'画报ID', max_length=20)
tag_id = models.BigIntegerField(verbose_name=u'标签ID', max_length=20)
is_online = models.BooleanField(verbose_name=u'是否上线', max_length=1)
def get_tag_by_id(self):
try:
tag_id_list = []
tags = Tag.objects.filter(id=self.tag_id).values_list("id", flat=True)
for i in tags:
tag_id_list.append(i.tag)
return tag_id_list
except:
logging.error("catch exception,err_msg:%s" % traceback.format_exc())
return False
def get_tag_by_name(self):
try:
tag_name_list = []
tags = Tag.objects.filter(id=self.tag_id).values_list("name", flat=True)
for i in tags:
tag_name_list.append(i.tag)
return tag_name_list
except: except:
logging.error("catch exception,err_msg:%s" % traceback.format_exc()) logging.error("catch exception,err_msg:%s" % traceback.format_exc())
......
...@@ -32,6 +32,8 @@ class PictorialTransfer(object): ...@@ -32,6 +32,8 @@ class PictorialTransfer(object):
tzlc_udpate_time = tzlc(update_time) tzlc_udpate_time = tzlc(update_time)
res["update_time"] = tzlc_udpate_time res["update_time"] = tzlc_udpate_time
res["high_quality_topic_num"] = instance.get_high_quality_topic_num() res["high_quality_topic_num"] = instance.get_high_quality_topic_num()
res["tag_id"] = instance.get_tag_by_id()
res["tag_name"] =instance.get_tag_by_name()
return res return res
except: except:
......
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