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
a21b1938
Commit
a21b1938
authored
Aug 21, 2019
by
lixiaofang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tag
parent
f4712750
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
29 additions
and
4 deletions
+29
-4
group.py
search/utils/group.py
+1
-1
pictorial.json
trans2es/mapping/pictorial.json
+3
-2
pictorial.py
trans2es/models/pictorial.py
+23
-1
pictorial_transfer.py
trans2es/utils/pictorial_transfer.py
+2
-0
No files found.
search/utils/group.py
View file @
a21b1938
...
...
@@ -221,7 +221,7 @@ class GroupUtils(object):
multi_fields
=
{
'name'
:
4
,
'description'
:
4
,
'tag_name'
:
4
'
edit_
tag_name'
:
4
}
query_fields
=
[
'^'
.
join
((
k
,
str
(
v
)))
for
(
k
,
v
)
in
multi_fields
.
items
()]
multi_match
=
{
...
...
trans2es/mapping/pictorial.json
View file @
a21b1938
...
...
@@ -23,8 +23,9 @@
"topic_vote_number"
:{
"type"
:
"long"
},
"latest_real_reply_time"
:{
"type"
:
"date"
,
"format"
:
"date_time_no_millis"
},
"latest_real_topic_time"
:{
"type"
:
"date"
,
"format"
:
"date_time_no_millis"
},
"real_user_activate_time"
:{
"type"
:
"date"
,
"format"
:
"date_time_no_millis"
}
"real_user_activate_time"
:{
"type"
:
"date"
,
"format"
:
"date_time_no_millis"
},
"edit_tag_id"
:{
"type"
:
"long"
},
"edit_tag_name"
:{
"type"
:
"text"
,
"analyzer"
:
"gm_default_index"
,
"search_analyzer"
:
"gm_default_search"
}
}
}
trans2es/models/pictorial.py
View file @
a21b1938
...
...
@@ -129,6 +129,27 @@ class Pictorial(models.Model):
logging
.
error
(
"catch exception,err_msg:
%
s"
%
traceback
.
format_exc
())
return
[]
def
get_edit_tag_id
(
self
):
try
:
tag_id_list
=
list
(
PictorialTag
.
objects
.
filter
(
pictorial_id
=
self
.
id
,
is_online
=
True
,
is_collection
=
1
)
.
values_list
(
"tag_id"
,
flat
=
True
))
return
tag_id_list
except
:
logging
.
error
(
"catch exception,err_msg:
%
s"
%
traceback
.
format_exc
())
return
[]
def
get_edit_tag_name
(
self
,
tag_id
):
try
:
tag_name_list
=
list
(
Tag
.
objects
.
filter
(
id__in
=
tag_id
,
is_online
=
True
,
is_collection
=
1
)
.
values_list
(
"name"
,
flat
=
True
))
return
tag_name_list
except
:
logging
.
error
(
"catch exception,err_msg:
%
s"
%
traceback
.
format_exc
())
return
[]
def
get_is_cover
(
self
,
topic_id_list
):
try
:
effective_num
=
0
...
...
@@ -268,7 +289,7 @@ class Pictorial(models.Model):
dt
=
max
(
datetime_list
)
logging
.
info
(
"get max datetime_list:
%
s"
%
dt
)
return
datetime
.
datetime
(
dt
.
year
,
dt
.
month
,
dt
.
day
,
dt
.
hour
,
dt
.
minute
,
dt
.
second
,
tzinfo
=
datetime
.
timezone
(
datetime
.
timedelta
(
hours
=
8
)))
tzinfo
=
datetime
.
timezone
(
datetime
.
timedelta
(
hours
=
8
)))
else
:
return
datetime
.
datetime
(
1980
,
1
,
1
,
0
,
0
,
0
,
tzinfo
=
datetime
.
timezone
(
datetime
.
timedelta
(
hours
=
8
)))
...
...
@@ -290,6 +311,7 @@ class PictorialTag(models.Model):
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
)
is_collection
=
models
.
IntegerField
(
verbose_name
=
u"是否编辑标签"
)
class
CommunityPictorialActivity
(
models
.
Model
):
...
...
trans2es/utils/pictorial_transfer.py
View file @
a21b1938
...
...
@@ -73,6 +73,8 @@ class PictorialTransfer(object):
res
[
"latest_real_reply_time"
]
=
instance
.
get_latest_real_reply_time
()
res
[
"latest_real_topic_time"
]
=
instance
.
get_latest_real_topic_time
()
res
[
"real_user_activate_time"
]
=
instance
.
get_real_user_activate_time
()
res
[
"edit_tag_id"
]
=
instance
.
get_edit_tag_id
()
res
[
"edit_tag_name"
]
=
instance
.
get_edit_tag_name
()
logging
.
info
(
"get data:
%
s"
%
res
)
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