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
ce68c272
Commit
ce68c272
authored
Dec 01, 2018
by
段英荣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
modify
parent
b9ffaa92
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
21 deletions
+31
-21
user.py
trans2es/models/user.py
+24
-18
user_transfer.py
trans2es/utils/user_transfer.py
+7
-3
No files found.
trans2es/models/user.py
View file @
ce68c272
...
...
@@ -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
):
...
...
trans2es/utils/user_transfer.py
View file @
ce68c272
...
...
@@ -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
...
...
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