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
66943362
Commit
66943362
authored
Apr 03, 2019
by
zhanglu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
帖子虚拟点赞
parent
2d47821b
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
0 deletions
+23
-0
topic.json
trans2es/mapping/topic.json
+1
-0
topic.py
trans2es/models/topic.py
+20
-0
topic_transfer.py
trans2es/utils/topic_transfer.py
+2
-0
No files found.
trans2es/mapping/topic.json
View file @
66943362
...
...
@@ -5,6 +5,7 @@
"is_online"
:{
"type"
:
"boolean"
},
//上线
"is_deleted"
:{
"type"
:
"boolean"
},
"vote_num"
:{
"type"
:
"long"
},
"total_vote_num"
:{
"type"
:
"long"
},
"reply_num"
:{
"type"
:
"long"
},
"name"
:{
"type"
:
"text"
,
"analyzer"
:
"gm_default_index"
,
"search_analyzer"
:
"gm_default_index"
},
"description"
:{
"type"
:
"text"
,
"analyzer"
:
"gm_default_index"
,
"search_analyzer"
:
"gm_default_index"
},
...
...
trans2es/models/topic.py
View file @
66943362
...
...
@@ -82,6 +82,14 @@ class Topic(models.Model):
platform
=
models
.
IntegerField
(
verbose_name
=
u'平台来源'
,
choices
=
GRAP_PLATFORM
,
default
=
GRAP_PLATFORM
.
ALPHA
)
platform_id
=
models
.
BigIntegerField
(
verbose_name
=
'用平台ID'
,
null
=
True
)
def
get_virtual_vote_num
(
self
):
try
:
topic_extra
=
TopicExtra
.
object
.
get
(
topic_id
=
self
.
id
)
return
topic_extra
.
virtual_vote_num
except
:
return
0
def
get_pictorial_id
(
self
):
try
:
pictorial_id_list
=
[]
...
...
@@ -238,3 +246,15 @@ class PictorialTopic(models.Model):
is_online
=
models
.
BooleanField
(
verbose_name
=
u"是否有效"
,
default
=
True
)
is_online
=
models
.
BooleanField
(
verbose_name
=
u'是否上线'
)
is_deleted
=
models
.
BooleanField
(
verbose_name
=
u'是否删除'
)
class
TopicExtra
(
BaseModel
):
"""帖子相关额外信息"""
class
Meta
:
verbose_name
=
'帖子额外信息'
app_label
=
'community'
db_table
=
'topic_extra'
topic_id
=
models
.
IntegerField
(
verbose_name
=
u"帖子ID"
,
db_index
=
True
)
virtual_vote_num
=
models
.
IntegerField
(
verbose_name
=
"帖子虚拟点赞"
)
trans2es/utils/topic_transfer.py
View file @
66943362
...
...
@@ -109,6 +109,8 @@ class TopicTransfer(object):
res
[
"update_time"
]
=
tzlc_update_time
res
[
"update_time_val"
]
=
int
(
time
.
mktime
(
tzlc_update_time
.
timetuple
()))
res
[
"total_vote_num"
]
=
instance
.
get_virtual_vote_num
()
+
instance
.
vote_num
logging
.
info
(
"test topic transfer time cost,time0:
%
d,time1:
%
d,time2:
%
d,time3:
%
d,time4:
%
d"
%
(
time0
,
time1
,
time2
,
time3
,
time4
))
return
res
except
:
...
...
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