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
f11db174
Commit
f11db174
authored
Jul 11, 2019
by
lixiaofang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
最新tab修改
parent
d064ecd6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
9 deletions
+12
-9
topic.json
trans2es/mapping/topic.json
+1
-0
topic.py
trans2es/models/topic.py
+11
-9
No files found.
trans2es/mapping/topic.json
View file @
f11db174
...
...
@@ -60,6 +60,7 @@
"type"
:
"nested"
,
"properties"
:{
"pictorial_id"
:{
"type"
:
"long"
},
"topic_add_time"
:{
"type"
:
"long"
},
"real_vote_cnt"
:{
"type"
:
"long"
},
"virt_vote_cnt"
:{
"type"
:
"long"
},
"total_vote_cnt"
:{
"type"
:
"long"
}
...
...
trans2es/models/topic.py
View file @
f11db174
...
...
@@ -203,7 +203,7 @@ class Topic(models.Model):
tag_id_list
=
TopicTag
.
objects
.
using
(
settings
.
SLAVE_DB_NAME
)
.
filter
(
topic_id
=
self
.
id
,
is_collection
=
1
)
.
values_list
(
"tag_id"
,
flat
=
True
)
return
list
(
tag_id_list
)
return
list
(
tag_id_list
)
except
:
logging
.
error
(
"catch exception,err_msg:
%
s"
%
traceback
.
format_exc
())
return
[]
...
...
@@ -282,26 +282,28 @@ class Topic(models.Model):
def
get_related_billboard
(
self
):
try
:
pictorial_ids
=
Topic
.
get_pictorial_id
(
self
)
related_billboard_list
=
list
()
for
pictorial_id
in
pictorial_ids
:
pictorials
=
PictorialTopic
.
objects
.
filter
(
topic_id
=
self
.
id
)
.
values
(
"pictorial_id"
,
"create_time"
)
for
pictorial_id
in
pictorials
:
query_result
=
TopicBillBoard
.
objects
.
filter
(
pictorial_id
=
pictorial_id
,
query_result
=
TopicBillBoard
.
objects
.
filter
(
pictorial_id
=
pictorial_id
.
get
(
'pictorial_id'
,
None
)
,
topic_id
=
self
.
id
)
.
values
()
.
first
()
if
query_result
==
None
:
related_billboard_list
.
append
({
"pictorial_id"
:
pictorial_id
,
"real_vote_cnt"
:
0
,
"virt_vote_cnt"
:
0
,
"total_vote_cnt"
:
0
})
related_billboard_list
.
append
(
{
"pictorial_id"
:
pictorial_id
.
get
(
'pictorial_id'
,
None
),
"real_vote_cnt"
:
0
,
"virt_vote_cnt"
:
0
,
"total_vote_cnt"
:
0
,
"topic_add_createtime"
:
int
(
time
.
mktime
(
pictorial_id
.
get
(
"create_time"
,
None
)
.
timetuple
()))})
else
:
total_vote_cnt
=
int
(
query_result
[
"virt_vote_cnt"
])
+
int
(
query_result
[
"real_vote_cnt"
])
related_billboard_list
.
append
(
{
"pictorial_id"
:
query_result
[
"pictorial_id"
],
"real_vote_cnt"
:
query_result
[
"real_vote_cnt"
],
"virt_vote_cnt"
:
query_result
[
"virt_vote_cnt"
],
"total_vote_cnt"
:
total_vote_cnt
})
"virt_vote_cnt"
:
query_result
[
"virt_vote_cnt"
],
"total_vote_cnt"
:
total_vote_cnt
,
"topic_add_createtime"
:
int
(
time
.
mktime
(
pictorial_id
.
get
(
"create_time"
,
None
)
.
timetuple
()))})
logging
.
info
(
"product_brand_info"
%
related_billboard_list
)
...
...
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