Commit 5499e5d1 authored by lixiaofang's avatar lixiaofang

add

parent 6faf4995
...@@ -8,29 +8,33 @@ import time ...@@ -8,29 +8,33 @@ import time
from libs.tools import tzlc from libs.tools import tzlc
from trans2es.models.user import User from trans2es.models.user import User
class UserTransfer(object): class UserTransfer(object):
@classmethod @classmethod
def get_follow_user_id_list(cls,userInstance): def get_follow_user_id_list(cls, userInstance):
follow_user_id_list = list() follow_user_id_list = list()
user_follows = userInstance.userfollow.filter(is_online=True) user_follows = userInstance.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)
follow_user_detail_list = list() follow_user_detail_list = list()
sql_data_list = User.objects.filter(user_id__in=follow_user_id_list,is_online=True,is_deleted=False) logging.info("get follow_user_id_list :%s "%follow_user_id_list)
for i in range(0, len(follow_user_id_list), 1000):
logging.info("get follow_user_id_list[i:i + 1000] " % follow_user_id_list[i:i+1000])
sql_data_list = User.objects.filter(user_id__in=follow_user_id_list[i:i + 1000], is_online=True,
is_deleted=False)
for detail_data in sql_data_list: for detail_data in sql_data_list:
item = { item = {
"user_id":detail_data.user_id, "user_id": detail_data.user_id,
"country_id":detail_data.country_id "country_id": detail_data.country_id
} }
follow_user_detail_list.append(item) follow_user_detail_list.append(item)
return follow_user_detail_list return follow_user_detail_list
@classmethod @classmethod
def get_user_data(cls,instance): def get_user_data(cls, instance):
try: try:
res = dict() res = dict()
...@@ -82,7 +86,6 @@ class UserTransfer(object): ...@@ -82,7 +86,6 @@ class UserTransfer(object):
res["pick_user_id_list"] = [] res["pick_user_id_list"] = []
res["same_group_user_id_list"] = [] res["same_group_user_id_list"] = []
return res return res
except: except:
logging.error("catch exception,err_msg:%s" % traceback.format_exc()) logging.error("catch exception,err_msg:%s" % traceback.format_exc())
......
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