Commit 09ad4446 authored by 段英荣's avatar 段英荣

modify

parent f2799640
......@@ -10,6 +10,7 @@
"content":{"type":"text"},
"content_level":{"type":"text"},
"user_id":{"type":"long"},
"tag_list":{"type":"long"},//标签属性
"share_num":{"type":"long"},
"pick_id_list":{"type":"long"},
"create_time":{"type":"date", "format":"date_time_no_millis"},
......
......@@ -7,7 +7,7 @@
"profile_pic":{"type":"text"}, //头像
"gender":{"type":"integer"},
"is_online":{"type":"boolean"},//是否上线
"tag_list":{"type":"text"},//标签属性
"tag_list":{"type":"long"},//标签属性
"city_id":{"type":"long"},
"country_id":{"type":"long"},
"attention_user_id_list":{//关注用户列表
......
......@@ -12,7 +12,6 @@ import datetime
class Group(models.Model):
class Meta:
verbose_name = u'小组'
app_label = 'community'
db_table = 'group'
name = models.CharField(verbose_name=u'名称', max_length=100, default='')
......
......@@ -13,9 +13,7 @@ from .group import Group
class GroupUserRole(models.Model):
class Meta:
verbose_name = u'group_user_role'
verbose_name_plural = u'group_user_role'
db_table = 'group_user_role'
app_label = 'api'
user_id = models.BigIntegerField(verbose_name=u'用户ID')
group = models.ForeignKey(
......
......@@ -14,7 +14,6 @@ class PickCelebrity(models.Model):
class Meta:
verbose_name=u"pick明星"
db_table = u"pickcelebrity"
app_label = "api"
id = models.IntegerField(primary_key=True,verbose_name=u"主键ID")
celebrity_id = models.IntegerField(verbose_name=u"明星ID")
......
......@@ -13,7 +13,6 @@ class PickTopic(models.Model):
class Meta:
verbose_name=u"pick帖子"
db_table = u"picktopic"
app_label = "api"
id = models.IntegerField(primary_key=True,verbose_name=u"主键ID")
topic_id = models.IntegerField(verbose_name=u"帖子ID")
......
......@@ -13,9 +13,7 @@ from .user import User
class PickUserRecord(models.Model):
class Meta:
verbose_name = u'用户之间pick'
verbose_name_plural = u'pickuserrecord'
db_table = 'pickuserrecord'
app_label = 'api'
pickuser_id = models.IntegerField(verbose_name="pick user id")
is_deleted = models.BooleanField(verbose_name="是否删除")
......
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from django.conf import settings
from django.core.management.base import BaseCommand, CommandError
import traceback
import logging
from libs.es import ESPerform
from django.db import models
import datetime
class TopicTag(models.Model):
class Meta:
verbose_name=u"帖子标签"
db_table="community_topictag"
id = models.IntegerField(primary_key=True,verbose_name=u"主键ID")
tag_id = models.IntegerField(verbose_name=u"标签ID")
topic_id = models.IntegerField(verbose_name=u"帖子ID")
is_online = models.BooleanField(verbose_name=u"是否在线")
class AccountUserTag(models.Model):
class Meta:
verbose_name=u"用户标签"
db_table="account_user_tag"
id = models.IntegerField(primary_key=True,verbose_name=u"主键ID")
tag_id = models.IntegerField(verbose_name=u"标签ID")
user_id = models.IntegerField(verbose_name=u"用户ID")
is_deleted = models.BooleanField(verbose_name=u"是否删除")
create_time = models.DateTimeField(verbose_name=u'创建时间',default=datetime.datetime.fromtimestamp(0))
update_time = models.DateTimeField(verbose_name=u'更新时间', default=datetime.datetime.fromtimestamp(0))
class Tag(models.Model):
class Meta:
verbose_name=u"标签"
db_table="community_tag"
id = models.IntegerField(primary_key=True,verbose_name=u"主键ID")
is_deleted = models.BooleanField(verbose_name=u"是否删除")
name = models.CharField(verbose_name=u"标签名称")
description = models.CharField(verbose_name=u"标签描述")
icon_url=models.CharField(verbose_name=u"icon_url")
create_time = models.DateTimeField(verbose_name=u'创建时间',default=datetime.datetime.fromtimestamp(0))
update_time = models.DateTimeField(verbose_name=u'更新时间', default=datetime.datetime.fromtimestamp(0))
......@@ -9,17 +9,14 @@ from libs.es import ESPerform
from django.db import models
import datetime
from .pick_topic import PickTopic
from .tag import TopicTag
class Topic(models.Model):
class Meta:
verbose_name = u'日记'
verbose_name_plural = u'日记'
db_table = 'topic'
app_label = 'api'
id = models.IntegerField(verbose_name='日记ID')
create_time = models.DateTimeField(verbose_name=u'日记创建时间',default=datetime.datetime.fromtimestamp(0))
update_time = models.DateTimeField(verbose_name=u'日记更新时间', default=datetime.datetime.fromtimestamp(0))
name = models.CharField(verbose_name='日记名称')
group_id = models.IntegerField(verbose_name='用户所在组ID')
user_id = models.IntegerField(verbose_name='用户ID')
......@@ -32,6 +29,8 @@ class Topic(models.Model):
is_online = models.BooleanField(verbose_name='是否上线')
is_deleted = models.BooleanField(verbose_name='是否删除')
content_level = models.CharField(verbose_name='内容等级')
create_time = models.DateTimeField(verbose_name=u'日记创建时间',default=datetime.datetime.fromtimestamp(0))
update_time = models.DateTimeField(verbose_name=u'日记更新时间', default=datetime.datetime.fromtimestamp(0))
def get_pick_id_info(self):
......@@ -46,3 +45,15 @@ class Topic(models.Model):
logging.error("catch exception,err_msg:%s" % traceback.format_exc())
return ()
def get_topic_tag_id_list(self):
try:
topic_tag_id_list = list()
query_results = TopicTag.objects.get(topic_id=self.id)
for item in query_results:
topic_tag_id_list.append(item.tag_id)
return topic_tag_id_list
except:
logging.error("catch exception,err_msg:%s" % traceback.format_exc())
return None
\ No newline at end of file
......@@ -9,14 +9,12 @@ from libs.es import ESPerform
from django.db import models
import datetime
from .group_user_role import GroupUserRole
from .tag import AccountUserTag
class User(models.Model):
class Meta:
verbose_name = u'用户'
verbose_name_plural = u'用户'
db_table = 'account_user'
app_label = 'api'
id = models.IntegerField(verbose_name="主键ID",primary_key=True)
user_id = models.BigIntegerField(verbose_name=u'用户id', unique=True)
......@@ -85,3 +83,15 @@ class User(models.Model):
return same_group_detail_list
def get_user_tag_id_list(self):
try:
user_tag_id_list = list()
query_results = AccountUserTag.objects.get(user_id=self.user_id)
for item in query_results:
user_tag_id_list.append(item.tag_id)
return user_tag_id_list
except:
logging.error("catch exception,err_msg:%s" % traceback.format_exc())
return None
\ No newline at end of file
......@@ -13,9 +13,7 @@ from .user import User
class UserFollow(models.Model):
class Meta:
verbose_name = u'用户关注'
verbose_name_plural = u'用户关注'
db_table = 'user_follow'
app_label = 'api'
user = models.ForeignKey(User,related_name='userfollow',to_field="user_id",on_delete=models.CASCADE)
follow_id = models.IntegerField(verbose_name="关注的用户ID")
......
......@@ -25,6 +25,7 @@ class TopicTransfer(object):
res["share_num"] = instance.share_num
res["pick_id_list"] = instance.get_pick_id_info()
res["tag_list"] = instance.get_topic_tag_id_list()
create_time = instance.create_time
res["create_time"] = tzlc(create_time)
......
......@@ -24,7 +24,7 @@ class UserTransfer(object):
res["create_time"] = tzlc(instance.create_time)
res["update_time"] = tzlc(instance.update_time)
res["tag_list"] = ""
res["tag_list"] = instance.get_user_tag_id_list()
res["attention_user_id_list"] = instance.get_follow_user_id_list()
res["pick_user_id_list"] = instance.get_pick_user_id_list()
res["same_group_user_id_list"] = instance.get_same_group_user_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