Commit 0d6fdd80 authored by zhanglu's avatar zhanglu

帖子to es

parent 5e3e16ab
......@@ -38,15 +38,19 @@
"like_num_crawl": {"type": "long"}, // 爬取点赞数
"comment_num_crawl": {"type": "long"}, // 爬取评论数
"is_crawl": {"type": "long"},
"is_crawl": {"type": "boolean"},
"platform": {"type": "long"},
"platform_id": {"type": "long"},
"drop_score":{"type": "double"}, // 人工降分
"sort_score":{"type": "double"}, // 排序分
"group_id":{"type": "long"}, //所在组ID
"group_name":{"type": "long"}, //所在组名称
"pictorial_id":{"type": "long"}, //所在组ID
"pictorial_name":{ // 所在组名称
"type": "text",
"analyzer": "gm_default_index",
"search_analyzer": "gm_default_index"
},
"create_time":{"type": "date", "format": "date_time_no_millis"},
"update_time":{"type": "date", "format": "date_time_no_millis"},
......
......@@ -13,3 +13,4 @@ from .tag import AccountUserTag
from .user import User
from .group import Group
from .topic import Topic
from .pictorial import PictorialTopic
from django.db import models
class PictorialTopic(models.Model):
"""画报帖子关系"""
class Meta:
verbose_name = u'画报帖子关系'
app_label = 'community'
db_table = 'community_pictorial_topic'
id = models.IntegerField(verbose_name=u'日记ID', primary_key=True)
pictorial_id = models.BigIntegerField(verbose_name=u'画报ID')
topic_id = models.BigIntegerField(verbose_name=u'帖子ID')
user_id = models.BigIntegerField(verbose_name=u'用户ID')
is_online = models.BooleanField(verbose_name=u"是否有效", default=True)
is_online = models.BooleanField(verbose_name=u'是否上线')
is_deleted = models.BooleanField(verbose_name=u'是否删除')
......@@ -10,6 +10,8 @@ from libs.es import ESPerform
from django.db import models
import datetime
from alpha_types.venus import GRAP_PLATFORM
from .pick_topic import PickTopic
from .tag import TopicTag, Tag
from .user_extra import UserExtra
......@@ -70,6 +72,17 @@ class Topic(models.Model):
create_time = models.DateTimeField(verbose_name=u'日记创建时间', default=datetime.datetime.fromtimestamp(0))
update_time = models.DateTimeField(verbose_name=u'日记更新时间', default=datetime.datetime.fromtimestamp(0))
is_crawl = models.BooleanField(verbose_name="是否是爬回的数据", default=False)
has_image = models.BooleanField(verbose_name=u"是否有图片", default=False)
virtual_content_level = models.CharField(verbose_name=u'模拟内容等级', max_length=100, default='')
like_num_crawl = models.IntegerField(verbose_name=u'爬取点赞数', default=0)
comment_num_crawl = models.IntegerField(verbose_name=u'爬取评论数', default=0)
is_recommend = models.IntegerField(verbose_name=u'是否推荐 0 非推荐 1 推荐', default=0)
sort_score = models.FloatField(verbose_name='排序分', default=0)
is_shadow = models.BooleanField(verbose_name="是否是马甲账户", default=False)
platform = models.IntegerField(verbose_name=u'平台来源', choices=GRAP_PLATFORM, default=GRAP_PLATFORM.ALPHA)
platform_id = models.BigIntegerField(verbose_name='用平台ID', null=True)
@property
def is_complaint(self):
"""是否被举报"""
......
......@@ -107,7 +107,7 @@ class TopicTransfer(object):
"is_deleted": instance.is_deleted,
"has_image": instance.topic_has_image(),
"has_video": instance.has_video,
"is_recommend": instance.is_recommend,
"is_recommend": True if instance.is_recommend else False,
"is_complaint": instance.is_complaint,
"vote_num": instance.vote_num,
......@@ -132,13 +132,6 @@ class TopicTransfer(object):
"sort_score": instance.sort_score,
}
if instance.group:
res["group_id"] = instance.group.id
res["group_name"] = instance.group.name
else:
res["group_id"] = -1
res["group_name"] = ""
(topic_tag_id_list, edit_tag_id_list) = instance.get_topic_tag_id_list()
res["tag_list"] = topic_tag_id_list
res["edit_tag_list"] = edit_tag_id_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