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
090777bb
Commit
090777bb
authored
Mar 22, 2019
by
zhanglu
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature/sun_topic2es' into 'master'
帖子 See merge request
!205
parents
777b3945
9839c2d1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
42 additions
and
14 deletions
+42
-14
pictorial.py
trans2es/models/pictorial.py
+15
-14
topic.py
trans2es/models/topic.py
+11
-0
topic_transfer.py
trans2es/utils/topic_transfer.py
+16
-0
No files found.
trans2es/models/pictorial.py
View file @
090777bb
# from django.db import models
import
datetime
from
django.db
import
models
# class PictorialTopic(models.Model):
# """画报帖子关系"""
# class Meta:
class
PictorialTopic
(
models
.
Model
):
# verbose_name = u'画报帖子关系'
"""画报帖子关系"""
# app_label = 'community'
# db_table = 'community_pictorial_topic'
# id = models.IntegerField(verbose_name=u'日记ID', primary_key=True)
class
Meta
:
# pictorial_id = models.BigIntegerField(verbose_name=u'画报ID')
verbose_name
=
u'画报帖子关系'
# topic_id = models.BigIntegerField(verbose_name=u'帖子ID')
app_label
=
'community'
# user_id = models.BigIntegerField(verbose_name=u'用户ID')
db_table
=
'community_pictorial_topic'
# is_online = models.BooleanField(verbose_name=u"是否有效", default=True)
# is_online = models.BooleanField(verbose_name=u'是否上线')
pictorial_id
=
models
.
BigIntegerField
(
verbose_name
=
u'画报ID'
)
# is_deleted = models.BooleanField(verbose_name=u'是否删除')
topic_id
=
models
.
BigIntegerField
(
verbose_name
=
u'帖子ID'
)
is_online
=
models
.
BooleanField
(
verbose_name
=
'是否上线'
)
is_deleted
=
models
.
BooleanField
(
verbose_name
=
'是否删除'
)
create_time
=
models
.
DateTimeField
(
verbose_name
=
u'创建时间'
,
default
=
datetime
.
datetime
.
fromtimestamp
(
0
))
update_time
=
models
.
DateTimeField
(
verbose_name
=
u'更新时间'
,
default
=
datetime
.
datetime
.
fromtimestamp
(
0
))
trans2es/models/topic.py
View file @
090777bb
...
@@ -16,6 +16,7 @@ from .pick_topic import PickTopic
...
@@ -16,6 +16,7 @@ from .pick_topic import PickTopic
from
.tag
import
TopicTag
,
Tag
from
.tag
import
TopicTag
,
Tag
from
.user_extra
import
UserExtra
from
.user_extra
import
UserExtra
from
.group
import
Group
from
.group
import
Group
from
.pictorial
import
PictorialTopic
class
ActionSumAboutTopic
(
models
.
Model
):
class
ActionSumAboutTopic
(
models
.
Model
):
...
@@ -83,6 +84,16 @@ class Topic(models.Model):
...
@@ -83,6 +84,16 @@ class Topic(models.Model):
platform
=
models
.
IntegerField
(
verbose_name
=
u'平台来源'
,
choices
=
GRAP_PLATFORM
,
default
=
GRAP_PLATFORM
.
ALPHA
)
platform
=
models
.
IntegerField
(
verbose_name
=
u'平台来源'
,
choices
=
GRAP_PLATFORM
,
default
=
GRAP_PLATFORM
.
ALPHA
)
platform_id
=
models
.
BigIntegerField
(
verbose_name
=
'用平台ID'
,
null
=
True
)
platform_id
=
models
.
BigIntegerField
(
verbose_name
=
'用平台ID'
,
null
=
True
)
def
get_pictorial_id
(
self
):
try
:
pictorial_id_list
=
[]
return
list
(
PictorialTopic
.
objects
.
filter
(
topic_id
=
self
.
id
,
is_online
=
True
,
is_deleted
=
False
)
.
values_list
(
"pictorial_id"
,
flat
=
True
))
except
:
logging
.
error
(
"catch exception,err_msg:
%
s"
%
traceback
.
format_exc
())
return
[]
@property
@property
def
is_complaint
(
self
):
def
is_complaint
(
self
):
"""是否被举报"""
"""是否被举报"""
...
...
trans2es/utils/topic_transfer.py
View file @
090777bb
...
@@ -34,6 +34,8 @@ class TopicTransfer(object):
...
@@ -34,6 +34,8 @@ class TopicTransfer(object):
res
[
"group_id"
]
=
-
1
res
[
"group_id"
]
=
-
1
res
[
"share_num"
]
=
instance
.
share_num
res
[
"share_num"
]
=
instance
.
share_num
res
[
"pictorial_id"
]
=
instance
.
get_pictorial_id
()
begin
=
time
.
time
()
begin
=
time
.
time
()
res
[
"pick_id_list"
]
=
instance
.
get_pick_id_info
()
res
[
"pick_id_list"
]
=
instance
.
get_pick_id_info
()
end
=
time
.
time
()
end
=
time
.
time
()
...
@@ -78,6 +80,20 @@ class TopicTransfer(object):
...
@@ -78,6 +80,20 @@ class TopicTransfer(object):
# else:
# else:
# res["language_type"] = instance.language_type
# res["language_type"] = instance.language_type
res
[
"is_shadow"
]
=
instance
.
is_shadow
res
[
"is_recommend"
]
=
True
if
instance
.
is_recommend
else
False
res
[
"is_complaint"
]
=
instance
.
is_complaint
res
[
"virtual_content_level"
]
=
instance
.
virtual_content_level
res
[
"like_num_crawl"
]
=
instance
.
like_num_crawl
res
[
"comment_num_crawl"
]
=
instance
.
comment_num_crawl
res
[
"is_crawl"
]
=
instance
.
is_crawl
res
[
"platform"
]
=
instance
.
platform
res
[
"platform_id"
]
=
instance
.
platform_id
res
[
"drop_score"
]
=
instance
.
drop_score
res
[
"sort_score"
]
=
instance
.
sort_score
create_time
=
instance
.
create_time
create_time
=
instance
.
create_time
tzlc_create_time
=
tzlc
(
create_time
)
tzlc_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