Commit 8fd1e445 authored by 段英荣's avatar 段英荣

modify

parent 9b54b87d
......@@ -46,8 +46,11 @@ class User(models.Model):
def get_latest_topic_time_val(self):
# 获取该用户最新发帖时间
latest_topic_time_val = -1
topic_records = Topic.objects.filter(user_id=self.user_id).order_by("-update_time")
topic_records = Topic.objects.filter(user_id=self.user_id).order_by("-update_time").values_list("update_time").first()
tzlc_topic_update_time = tzlc(topic_records.update_time)
latest_topic_time_val = int(time.mktime(tzlc_topic_update_time.timetuple()))
"""
check_index = 0
for record in topic_records:
topic_update_time = record.update_time
......@@ -55,7 +58,8 @@ class User(models.Model):
latest_topic_time_val = int(time.mktime(tzlc_topic_update_time.timetuple()))
check_index += 1
if check_index >= 1:
break
break
"""
return latest_topic_time_val
......
......@@ -34,9 +34,9 @@ class UserTransfer(object):
res["is_shadow"] = False
try:
#latest_topic_time_val = instance.get_latest_topic_time_val()
#res["latest_topic_time_val"] = latest_topic_time_val
res["latest_topic_time_val"] = -1
latest_topic_time_val = instance.get_latest_topic_time_val()
res["latest_topic_time_val"] = latest_topic_time_val
#res["latest_topic_time_val"] = -1
except:
logging.error("duan test,catch exception,err_msg:%s" % traceback.format_exc())
res["latest_topic_time_val"] = -1
......
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