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
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
8 deletions
+11
-8
topic.json
trans2es/mapping/topic.json
+1
-0
topic.py
trans2es/models/topic.py
+10
-8
No files found.
trans2es/mapping/topic.json
View file @
f11db174
...
@@ -60,6 +60,7 @@
...
@@ -60,6 +60,7 @@
"type"
:
"nested"
,
"type"
:
"nested"
,
"properties"
:{
"properties"
:{
"pictorial_id"
:{
"type"
:
"long"
},
"pictorial_id"
:{
"type"
:
"long"
},
"topic_add_time"
:{
"type"
:
"long"
},
"real_vote_cnt"
:{
"type"
:
"long"
},
"real_vote_cnt"
:{
"type"
:
"long"
},
"virt_vote_cnt"
:{
"type"
:
"long"
},
"virt_vote_cnt"
:{
"type"
:
"long"
},
"total_vote_cnt"
:{
"type"
:
"long"
}
"total_vote_cnt"
:{
"type"
:
"long"
}
...
...
trans2es/models/topic.py
View file @
f11db174
...
@@ -282,26 +282,28 @@ class Topic(models.Model):
...
@@ -282,26 +282,28 @@ class Topic(models.Model):
def
get_related_billboard
(
self
):
def
get_related_billboard
(
self
):
try
:
try
:
pictorial_ids
=
Topic
.
get_pictorial_id
(
self
)
related_billboard_list
=
list
()
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
()
topic_id
=
self
.
id
)
.
values
()
.
first
()
if
query_result
==
None
:
if
query_result
==
None
:
related_billboard_list
.
append
({
"pictorial_id"
:
pictorial_id
,
"real_vote_cnt"
:
0
,
related_billboard_list
.
append
(
"virt_vote_cnt"
:
0
,
"total_vote_cnt"
:
0
})
{
"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
:
else
:
total_vote_cnt
=
int
(
query_result
[
"virt_vote_cnt"
])
+
int
(
query_result
[
"real_vote_cnt"
])
total_vote_cnt
=
int
(
query_result
[
"virt_vote_cnt"
])
+
int
(
query_result
[
"real_vote_cnt"
])
related_billboard_list
.
append
(
related_billboard_list
.
append
(
{
"pictorial_id"
:
query_result
[
"pictorial_id"
],
"real_vote_cnt"
:
query_result
[
"real_vote_cnt"
],
{
"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
)
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