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

modify

parent b9ffaa92
......@@ -33,24 +33,30 @@ class User(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_shadow = False
is_recommend = False
query_sql = UserExtra.objects.filter(user_id__in=[user_id])
for record in query_sql:
is_recommend = record.is_recommend
is_shadow = record.is_shadow
# 获取该用户最新发帖时间
latest_topic_time_val = -1
topic_records = Topic.objects.filter(user_id__in=[user_id]).order_by(update_time)
check_index = 0
for record in topic_records:
topic_update_time = record.update_time
tzlc_topic_update_time = tzlc(topic_update_time)
latest_topic_time_val = int(time.mktime(tzlc_topic_update_time.timetuple()))
check_index += 1
if check_index >= 1:
break
def get_is_recommend_flag(self):
is_shadow = False
is_recommend = False
query_sql = UserExtra.objects.filter(user_id=self.user_id)
for record in query_sql:
is_recommend = record.is_recommend
is_shadow = record.is_shadow
return (is_recommend,is_shadow)
def get_latest_topic_time_val(self):
# 获取该用户最新发帖时间
latest_topic_time_val = -1
topic_records = Topic.objects.filter(user_id__in=self.user_id).order_by(self.update_time)
check_index = 0
for record in topic_records:
topic_update_time = record.update_time
tzlc_topic_update_time = tzlc(topic_update_time)
latest_topic_time_val = int(time.mktime(tzlc_topic_update_time.timetuple()))
check_index += 1
if check_index >= 1:
break
return latest_topic_time_val
def get_follow_user_id_list(self):
......
......@@ -22,9 +22,13 @@ class UserTransfer(object):
res["city_id"] = instance.city_id
res["country_id"] = instance.country_id
res["is_online"] = instance.is_online
res["is_recommend"] = instance.is_recommend
res["is_shadow"] = instance.is_shadow
res["latest_topic_time_val"] = instance.latest_topic_time_val
(is_recommend,is_shadow) = instance.get_is_recommend_flag()
res["is_recommend"] = is_recommend
res["is_shadow"] = is_shadow
latest_topic_time_val = instance.get_latest_topic_time_val
res["latest_topic_time_val"] = latest_topic_time_val
tzlc_create_time = tzlc(instance.create_time)
res["create_time"] = tzlc_create_time
......
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