Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
P
physical
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
alpha
physical
Commits
5499e5d1
Commit
5499e5d1
authored
Feb 19, 2019
by
lixiaofang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add
parent
6faf4995
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
14 deletions
+16
-14
user_transfer.py
trans2es/utils/user_transfer.py
+16
-14
No files found.
trans2es/utils/user_transfer.py
View file @
5499e5d1
...
...
@@ -8,29 +8,33 @@ import time
from
libs.tools
import
tzlc
from
trans2es.models.user
import
User
class
UserTransfer
(
object
):
@classmethod
def
get_follow_user_id_list
(
cls
,
userInstance
):
def
get_follow_user_id_list
(
cls
,
userInstance
):
follow_user_id_list
=
list
()
user_follows
=
userInstance
.
userfollow
.
filter
(
is_online
=
True
)
for
user_follow
in
user_follows
:
follow_user_id_list
.
append
(
user_follow
.
follow_id
)
follow_user_detail_list
=
list
()
sql_data_list
=
User
.
objects
.
filter
(
user_id__in
=
follow_user_id_list
,
is_online
=
True
,
is_deleted
=
False
)
for
detail_data
in
sql_data_list
:
item
=
{
"user_id"
:
detail_data
.
user_id
,
"country_id"
:
detail_data
.
country_id
}
follow_user_detail_list
.
append
(
item
)
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
:
item
=
{
"user_id"
:
detail_data
.
user_id
,
"country_id"
:
detail_data
.
country_id
}
follow_user_detail_list
.
append
(
item
)
return
follow_user_detail_list
@classmethod
def
get_user_data
(
cls
,
instance
):
def
get_user_data
(
cls
,
instance
):
try
:
res
=
dict
()
...
...
@@ -80,10 +84,9 @@ class UserTransfer(object):
res
[
"attention_user_id_list"
]
=
[]
res
[
"attention_group_id_list"
]
=
[]
res
[
"pick_user_id_list"
]
=
[]
res
[
"same_group_user_id_list"
]
=
[]
res
[
"same_group_user_id_list"
]
=
[]
return
res
except
:
logging
.
error
(
"catch exception,err_msg:
%
s"
%
traceback
.
format_exc
())
return
{}
\ No newline at end of file
return
{}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment