Commit 94839792 authored by 段英荣's avatar 段英荣

modify

parent 59ab7047
{ {
"dynamic":"strict", "dynamic":"strict",
"properties": { "properties": {
"id":{"type":"long"}, "user_id":{"type":"long"},
"name":{"type":"text"}, "nick_name":{"type":"text"}, //昵称
"icon":{"type":"text"}, "profile_pic":{"type":"text"}, //头像
"tag_list":{"type":"text"}, "gender":{"type":"integer"},
"attention_user_id_list":{"type":"long"}, "is_online":{"type":"boolean"},//是否上线
"pick_user_id_list":{"type":"long"}, "tag_list":{"type":"text"},//标签属性
"same_group_user_id_list":{"type":"text"} "city_id":{"type":"long"},
"country_id":{"type":"long"},
"attention_user_id_list":{"type":"long"},//关注用户列表
"pick_user_id_list":{"type":"long"},//pick用户列表
"same_group_user_id_list":{"type":"text"},//同组用户列表
"create_time":{"type":"date", "format":"date_time_no_millis"},
"update_time":{"type":"date", "format":"date_time_no_millis"}
} }
} }
\ No newline at end of file
...@@ -18,7 +18,6 @@ class PickUserRecord(models.Model): ...@@ -18,7 +18,6 @@ class PickUserRecord(models.Model):
app_label = 'api' app_label = 'api'
pickuser_id = models.IntegerField(verbose_name="pick user id") pickuser_id = models.IntegerField(verbose_name="pick user id")
#user_id = models.IntegerField(verbose_name="用户ID")
is_deleted = models.BooleanField(verbose_name="是否删除") is_deleted = models.BooleanField(verbose_name="是否删除")
is_pick = models.BooleanField(verbose_name="is_pick") is_pick = models.BooleanField(verbose_name="is_pick")
create_time = models.DateTimeField(verbose_name=u'日记创建时间',default=datetime.datetime.fromtimestamp(0)) create_time = models.DateTimeField(verbose_name=u'日记创建时间',default=datetime.datetime.fromtimestamp(0))
......
...@@ -14,18 +14,23 @@ class User(models.Model): ...@@ -14,18 +14,23 @@ class User(models.Model):
class Meta: class Meta:
verbose_name = u'用户' verbose_name = u'用户'
verbose_name_plural = u'用户' verbose_name_plural = u'用户'
db_table = 'user' db_table = 'account_user'
app_label = 'api' app_label = 'api'
id = models.IntegerField(primary_key=True,verbose_name="用户ID") user_id = models.BigIntegerField(verbose_name=u'用户唯一id', unique=True)
name = models.CharField(verbose_name="用户名称") nick_name = models.CharField(verbose_name=u'昵称', max_length=255, default='')
icon = models.CharField(verbose_name='') profile_pic = models.CharField(verbose_name=u'头像', max_length=300)
gender = models.SmallIntegerField(verbose_name=u'性别')
city_id = models.IntegerField(verbose_name=u'城市id')
country_id = models.IntegerField(verbose_name='国家id')
is_online = models.BooleanField(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_follow_user_id_list(self): def get_follow_user_id_list(self):
print("********duan add,use attribute:%s" % str(dir(self)))
follow_user_id_list = list() follow_user_id_list = list()
user_follows = self.myuserfollow.filter(is_online=True) user_follows = self.userfollow.filter(is_online=True)
for user_follow in user_follows: for user_follow in user_follows:
follow_user_id_list.append(user_follow.follow_id) follow_user_id_list.append(user_follow.follow_id)
......
...@@ -17,9 +17,7 @@ class UserFollow(models.Model): ...@@ -17,9 +17,7 @@ class UserFollow(models.Model):
db_table = 'user_follow' db_table = 'user_follow'
app_label = 'api' app_label = 'api'
#user_id = models.IntegerField(verbose_name="用户ID") user = models.ForeignKey(User,related_name='userfollow',on_delete=models.CASCADE)
user = models.ForeignKey(User,related_name='myuserfollow',on_delete=models.CASCADE)
#user = models.ForeignKey(User, related_name='userFollow',on_delete=models.CASCADE)
follow_id = models.IntegerField(verbose_name="关注的用户ID") follow_id = models.IntegerField(verbose_name="关注的用户ID")
is_online = models.BooleanField(verbose_name="是否上线") is_online = models.BooleanField(verbose_name="是否上线")
is_deleted = models.BooleanField(verbose_name="是否删除") is_deleted = models.BooleanField(verbose_name="是否删除")
......
...@@ -4,6 +4,7 @@ import os ...@@ -4,6 +4,7 @@ import os
import sys import sys
import logging import logging
import traceback import traceback
from libs.tools import tzlc
class UserTransfer(object): class UserTransfer(object):
...@@ -12,11 +13,18 @@ class UserTransfer(object): ...@@ -12,11 +13,18 @@ class UserTransfer(object):
try: try:
res = dict() res = dict()
res["id"] = instance.id res["user_id"] = instance.user_id
res["icon"] = instance.icon res["nick_name"] = instance.nick_name
res["name"] = instance.name res["profile_pic"] = instance.profile_pic
res["tag_list"] = "" res["gender"] = instance.gender
res["city_id"] = instance.city_id
res["country_id"] = instance.country_id
res["is_online"] = instance.is_online
res["create_time"] = tzlc(instance.create_time)
res["update_time"] = tzlc(instance.update_time)
res["tag_list"] = ""
print("follow_user_id_list:%s" % str(instance.get_follow_user_id_list)) print("follow_user_id_list:%s" % str(instance.get_follow_user_id_list))
res["attention_user_id_list"] = instance.get_follow_user_id_list() res["attention_user_id_list"] = instance.get_follow_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