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
94bcbd51
Commit
94bcbd51
authored
Mar 20, 2019
by
lixiaofang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add
parent
ed5f1f69
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
15 deletions
+23
-15
workspace.xml
.idea/workspace.xml
+0
-0
topic.py
trans2es/models/topic.py
+23
-15
No files found.
.idea/workspace.xml
View file @
94bcbd51
This diff is collapsed.
Click to expand it.
trans2es/models/topic.py
View file @
94bcbd51
...
...
@@ -85,10 +85,13 @@ class Topic(models.Model):
platform_id
=
models
.
BigIntegerField
(
verbose_name
=
'用平台ID'
,
null
=
True
)
def
get_pictorial_id
(
self
):
try
:
try
logging
.
info
(
"get user id :
%
s"
%
self
.
id
)
pictorial_id
=
PictorialTopic
.
objects
.
filter
(
topic_id
=
self
.
id
)
if
len
(
pictorial_id
)
>
0
:
logging
.
info
(
"get user attention pictorial id :
%
s"
%
pictorial_id
)
if
len
(
pictorial_id
)
>
0
:
logging
.
info
(
"get user attention pictorial id :
%
s"
%
pictorial_id
)
return
pictorial_id
except
:
logging
.
error
(
"catch exception,err_msg:
%
s"
%
traceback
.
format_exc
())
...
...
@@ -107,7 +110,8 @@ class Topic(models.Model):
try
:
has_image
=
False
query_list
=
TopicImage
.
objects
.
using
(
settings
.
SLAVE_DB_NAME
)
.
filter
(
topic_id
=
self
.
id
,
is_deleted
=
False
,
is_online
=
True
)
query_list
=
TopicImage
.
objects
.
using
(
settings
.
SLAVE_DB_NAME
)
.
filter
(
topic_id
=
self
.
id
,
is_deleted
=
False
,
is_online
=
True
)
if
len
(
query_list
)
>
0
:
has_image
=
True
...
...
@@ -133,12 +137,13 @@ class Topic(models.Model):
topic_tag_id_list
=
list
()
edit_tag_id_list
=
list
()
tag_id_list
=
TopicTag
.
objects
.
using
(
settings
.
SLAVE_DB_NAME
)
.
filter
(
topic_id
=
self
.
id
)
.
values_list
(
"tag_id"
,
flat
=
True
)
tag_id_list
=
TopicTag
.
objects
.
using
(
settings
.
SLAVE_DB_NAME
)
.
filter
(
topic_id
=
self
.
id
)
.
values_list
(
"tag_id"
,
flat
=
True
)
tag_query_results
=
Tag
.
objects
.
using
(
settings
.
SLAVE_DB_NAME
)
.
filter
(
id__in
=
tag_id_list
)
for
tag_item
in
tag_query_results
:
is_online
=
tag_item
.
is_online
is_deleted
=
tag_item
.
is_deleted
collection
=
tag_item
.
collection
is_online
=
tag_item
.
is_online
is_deleted
=
tag_item
.
is_deleted
collection
=
tag_item
.
collection
if
is_online
and
not
is_deleted
:
topic_tag_id_list
.
append
(
tag_item
.
id
)
...
...
@@ -148,7 +153,7 @@ class Topic(models.Model):
return
(
topic_tag_id_list
,
edit_tag_id_list
)
except
:
logging
.
error
(
"catch exception,err_msg:
%
s"
%
traceback
.
format_exc
())
return
([],[])
return
([],
[])
def
get_tag_name_list
(
self
,
tag_id_list
):
try
:
...
...
@@ -188,9 +193,12 @@ class Topic(models.Model):
elif
self
.
content_level
==
'3'
:
offline_score
+=
2.0
exposure_count
=
ActionSumAboutTopic
.
objects
.
using
(
settings
.
SLAVE_DB_NAME
)
.
filter
(
topic_id
=
self
.
id
,
data_type
=
1
)
.
count
()
click_count
=
ActionSumAboutTopic
.
objects
.
using
(
settings
.
SLAVE_DB_NAME
)
.
filter
(
topic_id
=
self
.
id
,
data_type
=
2
)
.
count
()
uv_num
=
ActionSumAboutTopic
.
objects
.
using
(
settings
.
SLAVE_DB_NAME
)
.
filter
(
topic_id
=
self
.
id
,
data_type
=
3
)
.
count
()
exposure_count
=
ActionSumAboutTopic
.
objects
.
using
(
settings
.
SLAVE_DB_NAME
)
.
filter
(
topic_id
=
self
.
id
,
data_type
=
1
)
.
count
()
click_count
=
ActionSumAboutTopic
.
objects
.
using
(
settings
.
SLAVE_DB_NAME
)
.
filter
(
topic_id
=
self
.
id
,
data_type
=
2
)
.
count
()
uv_num
=
ActionSumAboutTopic
.
objects
.
using
(
settings
.
SLAVE_DB_NAME
)
.
filter
(
topic_id
=
self
.
id
,
data_type
=
3
)
.
count
()
if
exposure_count
>
0
:
offline_score
+=
click_count
/
exposure_count
...
...
@@ -221,6 +229,7 @@ class TopicComplaint(models.Model):
id
=
models
.
IntegerField
(
verbose_name
=
'日记图片ID'
,
primary_key
=
True
)
user_id
=
models
.
BigIntegerField
(
verbose_name
=
u'用户ID'
,
db_index
=
True
)
topic
=
models
.
ForeignKey
(
Topic
,
verbose_name
=
u"关联的帖子"
,
null
=
True
,
blank
=
True
,
default
=
None
,
on_delete
=
models
.
CASCADE
,
related_name
=
'complaints'
)
Topic
,
verbose_name
=
u"关联的帖子"
,
null
=
True
,
blank
=
True
,
default
=
None
,
on_delete
=
models
.
CASCADE
,
related_name
=
'complaints'
)
is_online
=
models
.
BooleanField
(
verbose_name
=
u"是否有效"
,
default
=
True
)
\ No newline at end of file
is_online
=
models
.
BooleanField
(
verbose_name
=
u"是否有效"
,
default
=
True
)
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