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
0d6fdd80
Commit
0d6fdd80
authored
Mar 13, 2019
by
zhanglu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
帖子to es
parent
5e3e16ab
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
40 additions
and
11 deletions
+40
-11
business_topic.json
trans2es/mapping/business_topic.json
+7
-3
__init__.py
trans2es/models/__init__.py
+1
-0
pictorial.py
trans2es/models/pictorial.py
+18
-0
topic.py
trans2es/models/topic.py
+13
-0
topic_transfer.py
trans2es/utils/topic_transfer.py
+1
-8
No files found.
trans2es/mapping/business_topic.json
View file @
0d6fdd80
...
...
@@ -38,15 +38,19 @@
"like_num_crawl"
:
{
"type"
:
"long"
},
//
爬取点赞数
"comment_num_crawl"
:
{
"type"
:
"long"
},
//
爬取评论数
"is_crawl"
:
{
"type"
:
"
long
"
},
"is_crawl"
:
{
"type"
:
"
boolean
"
},
"platform"
:
{
"type"
:
"long"
},
"platform_id"
:
{
"type"
:
"long"
},
"drop_score"
:{
"type"
:
"double"
},
//
人工降分
"sort_score"
:{
"type"
:
"double"
},
//
排序分
"group_id"
:{
"type"
:
"long"
},
//所在组ID
"group_name"
:{
"type"
:
"long"
},
//所在组名称
"pictorial_id"
:{
"type"
:
"long"
},
//所在组ID
"pictorial_name"
:{
//
所在组名称
"type"
:
"text"
,
"analyzer"
:
"gm_default_index"
,
"search_analyzer"
:
"gm_default_index"
},
"create_time"
:{
"type"
:
"date"
,
"format"
:
"date_time_no_millis"
},
"update_time"
:{
"type"
:
"date"
,
"format"
:
"date_time_no_millis"
},
...
...
trans2es/models/__init__.py
View file @
0d6fdd80
...
...
@@ -13,3 +13,4 @@ from .tag import AccountUserTag
from
.user
import
User
from
.group
import
Group
from
.topic
import
Topic
from
.pictorial
import
PictorialTopic
trans2es/models/pictorial.py
0 → 100644
View file @
0d6fdd80
from
django.db
import
models
class
PictorialTopic
(
models
.
Model
):
"""画报帖子关系"""
class
Meta
:
verbose_name
=
u'画报帖子关系'
app_label
=
'community'
db_table
=
'community_pictorial_topic'
id
=
models
.
IntegerField
(
verbose_name
=
u'日记ID'
,
primary_key
=
True
)
pictorial_id
=
models
.
BigIntegerField
(
verbose_name
=
u'画报ID'
)
topic_id
=
models
.
BigIntegerField
(
verbose_name
=
u'帖子ID'
)
user_id
=
models
.
BigIntegerField
(
verbose_name
=
u'用户ID'
)
is_online
=
models
.
BooleanField
(
verbose_name
=
u"是否有效"
,
default
=
True
)
is_online
=
models
.
BooleanField
(
verbose_name
=
u'是否上线'
)
is_deleted
=
models
.
BooleanField
(
verbose_name
=
u'是否删除'
)
trans2es/models/topic.py
View file @
0d6fdd80
...
...
@@ -10,6 +10,8 @@ from libs.es import ESPerform
from
django.db
import
models
import
datetime
from
alpha_types.venus
import
GRAP_PLATFORM
from
.pick_topic
import
PickTopic
from
.tag
import
TopicTag
,
Tag
from
.user_extra
import
UserExtra
...
...
@@ -70,6 +72,17 @@ class Topic(models.Model):
create_time
=
models
.
DateTimeField
(
verbose_name
=
u'日记创建时间'
,
default
=
datetime
.
datetime
.
fromtimestamp
(
0
))
update_time
=
models
.
DateTimeField
(
verbose_name
=
u'日记更新时间'
,
default
=
datetime
.
datetime
.
fromtimestamp
(
0
))
is_crawl
=
models
.
BooleanField
(
verbose_name
=
"是否是爬回的数据"
,
default
=
False
)
has_image
=
models
.
BooleanField
(
verbose_name
=
u"是否有图片"
,
default
=
False
)
virtual_content_level
=
models
.
CharField
(
verbose_name
=
u'模拟内容等级'
,
max_length
=
100
,
default
=
''
)
like_num_crawl
=
models
.
IntegerField
(
verbose_name
=
u'爬取点赞数'
,
default
=
0
)
comment_num_crawl
=
models
.
IntegerField
(
verbose_name
=
u'爬取评论数'
,
default
=
0
)
is_recommend
=
models
.
IntegerField
(
verbose_name
=
u'是否推荐 0 非推荐 1 推荐'
,
default
=
0
)
sort_score
=
models
.
FloatField
(
verbose_name
=
'排序分'
,
default
=
0
)
is_shadow
=
models
.
BooleanField
(
verbose_name
=
"是否是马甲账户"
,
default
=
False
)
platform
=
models
.
IntegerField
(
verbose_name
=
u'平台来源'
,
choices
=
GRAP_PLATFORM
,
default
=
GRAP_PLATFORM
.
ALPHA
)
platform_id
=
models
.
BigIntegerField
(
verbose_name
=
'用平台ID'
,
null
=
True
)
@property
def
is_complaint
(
self
):
"""是否被举报"""
...
...
trans2es/utils/topic_transfer.py
View file @
0d6fdd80
...
...
@@ -107,7 +107,7 @@ class TopicTransfer(object):
"is_deleted"
:
instance
.
is_deleted
,
"has_image"
:
instance
.
topic_has_image
(),
"has_video"
:
instance
.
has_video
,
"is_recommend"
:
instance
.
is_recommend
,
"is_recommend"
:
True
if
instance
.
is_recommend
else
False
,
"is_complaint"
:
instance
.
is_complaint
,
"vote_num"
:
instance
.
vote_num
,
...
...
@@ -132,13 +132,6 @@ class TopicTransfer(object):
"sort_score"
:
instance
.
sort_score
,
}
if
instance
.
group
:
res
[
"group_id"
]
=
instance
.
group
.
id
res
[
"group_name"
]
=
instance
.
group
.
name
else
:
res
[
"group_id"
]
=
-
1
res
[
"group_name"
]
=
""
(
topic_tag_id_list
,
edit_tag_id_list
)
=
instance
.
get_topic_tag_id_list
()
res
[
"tag_list"
]
=
topic_tag_id_list
res
[
"edit_tag_list"
]
=
edit_tag_id_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