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
5e13f898
Commit
5e13f898
authored
Mar 21, 2019
by
lixiaofang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add
parent
2bc3df2e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
58 additions
and
8 deletions
+58
-8
pictorial.json
trans2es/mapping/pictorial.json
+5
-1
pictorial.py
trans2es/models/pictorial.py
+51
-7
pictorial_transfer.py
trans2es/utils/pictorial_transfer.py
+2
-0
No files found.
trans2es/mapping/pictorial.json
View file @
5e13f898
...
...
@@ -12,6 +12,9 @@
"icon"
:{
"type"
:
"text"
},
"high_quality_topic_num"
:{
"type"
:
"long"
},
//前一天该小组
4
&
5
星帖子数量
"create_time"
:{
"type"
:
"date"
,
"format"
:
"date_time_no_millis"
},
"update_time"
:{
"type"
:
"date"
,
"format"
:
"date_time_no_millis"
}
"update_time"
:{
"type"
:
"date"
,
"format"
:
"date_time_no_millis"
},
"tag_id"
:{
"type"
:
"long"
},
"tag_name"
:{
"type"
:
"long"
}
}
}
\ No newline at end of file
trans2es/models/pictorial.py
View file @
5e13f898
...
...
@@ -2,7 +2,10 @@ from django.db import models
import
datetime
import
logging
import
traceback
# from .topic import Topic
from
.tag
import
Tag
from
.topic
import
Topic
class
PictorialTopic
(
models
.
Model
):
"""画报帖子关系"""
...
...
@@ -68,12 +71,53 @@ class Pictorial(models.Model):
logging
.
info
(
"get topic_id_list:
%
s"
%
topic_id_list
)
# topic_num = Topic.filter(content_level__in=("4", "5"), create_time__gte=yesterday_begin_time,
# create_time__lte=yesterday_end_time, topic_id_in=topic_id_list).count()
#
# logging.info("get topic_num:%s" % topic_num)
#
# return topic_num
topic_num
=
Topic
.
filter
(
content_level__in
=
(
"4"
,
"5"
),
create_time__gte
=
yesterday_begin_time
,
create_time__lte
=
yesterday_end_time
,
topic_id_in
=
topic_id_list
)
.
count
()
logging
.
info
(
"get topic_num:
%
s"
%
topic_num
)
return
topic_num
except
:
logging
.
error
(
"catch exception,err_msg:
%
s"
%
traceback
.
format_exc
())
return
False
class
PictorialTag
(
models
.
Model
):
"""画报关注标签"""
class
Meta
:
verbose_name
=
u"画报标签"
app_label
=
"community"
db_table
=
"community_pictorial_tag"
id
=
models
.
IntegerField
(
verbose_name
=
u'关注ID'
,
primary_key
=
True
)
create_time
=
models
.
DateTimeField
(
verbose_name
=
u'创建时间'
,
default
=
datetime
.
datetime
.
fromtimestamp
(
0
))
update_time
=
models
.
DateTimeField
(
verbose_name
=
u'更新时间'
,
default
=
datetime
.
datetime
.
fromtimestamp
(
0
))
pictorial_id
=
models
.
BigIntegerField
(
verbose_name
=
u'画报ID'
,
max_length
=
20
)
tag_id
=
models
.
BigIntegerField
(
verbose_name
=
u'标签ID'
,
max_length
=
20
)
is_online
=
models
.
BooleanField
(
verbose_name
=
u'是否上线'
,
max_length
=
1
)
def
get_tag_by_id
(
self
):
try
:
tag_id_list
=
[]
tags
=
Tag
.
objects
.
filter
(
id
=
self
.
tag_id
)
.
values_list
(
"id"
,
flat
=
True
)
for
i
in
tags
:
tag_id_list
.
append
(
i
.
tag
)
return
tag_id_list
except
:
logging
.
error
(
"catch exception,err_msg:
%
s"
%
traceback
.
format_exc
())
return
False
def
get_tag_by_name
(
self
):
try
:
tag_name_list
=
[]
tags
=
Tag
.
objects
.
filter
(
id
=
self
.
tag_id
)
.
values_list
(
"name"
,
flat
=
True
)
for
i
in
tags
:
tag_name_list
.
append
(
i
.
tag
)
return
tag_name_list
except
:
logging
.
error
(
"catch exception,err_msg:
%
s"
%
traceback
.
format_exc
())
...
...
trans2es/utils/pictorial_transfer.py
View file @
5e13f898
...
...
@@ -32,6 +32,8 @@ class PictorialTransfer(object):
tzlc_udpate_time
=
tzlc
(
update_time
)
res
[
"update_time"
]
=
tzlc_udpate_time
res
[
"high_quality_topic_num"
]
=
instance
.
get_high_quality_topic_num
()
res
[
"tag_id"
]
=
instance
.
get_tag_by_id
()
res
[
"tag_name"
]
=
instance
.
get_tag_by_name
()
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