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
1e2e7b19
Commit
1e2e7b19
authored
Jul 19, 2019
by
黄凯
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'add_reply_time' into 'master'
Add reply time See merge request alpha/physical!398
parents
b1fbf8c6
2dccd818
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
43 additions
and
25 deletions
+43
-25
Project.xml
.idea/codeStyles/Project.xml
+0
-25
es.py
libs/es.py
+1
-0
topic-high-star.json
trans2es/mapping/topic-high-star.json
+1
-0
topic-star-routing.json
trans2es/mapping/topic-star-routing.json
+1
-0
topic-star.json
trans2es/mapping/topic-star.json
+1
-0
topic.json
trans2es/mapping/topic.json
+1
-0
topic.py
trans2es/models/topic.py
+35
-0
topic_transfer.py
trans2es/utils/topic_transfer.py
+3
-0
No files found.
.idea/codeStyles/Project.xml
View file @
1e2e7b19
...
...
@@ -24,29 +24,5 @@
<option
name=
"ITERATION_ELEMENTS_WRAPPING"
value=
"chop_down_if_not_single"
/>
</formatting-settings>
</DBN-SQL>
<DBN-PSQL>
<case-options
enabled=
"false"
>
<option
name=
"KEYWORD_CASE"
value=
"lower"
/>
<option
name=
"FUNCTION_CASE"
value=
"lower"
/>
<option
name=
"PARAMETER_CASE"
value=
"lower"
/>
<option
name=
"DATATYPE_CASE"
value=
"lower"
/>
<option
name=
"OBJECT_CASE"
value=
"preserve"
/>
</case-options>
<formatting-settings
enabled=
"false"
/>
</DBN-PSQL>
<DBN-SQL>
<case-options
enabled=
"false"
>
<option
name=
"KEYWORD_CASE"
value=
"lower"
/>
<option
name=
"FUNCTION_CASE"
value=
"lower"
/>
<option
name=
"PARAMETER_CASE"
value=
"lower"
/>
<option
name=
"DATATYPE_CASE"
value=
"lower"
/>
<option
name=
"OBJECT_CASE"
value=
"preserve"
/>
</case-options>
<formatting-settings
enabled=
"false"
>
<option
name=
"STATEMENT_SPACING"
value=
"one_line"
/>
<option
name=
"CLAUSE_CHOP_DOWN"
value=
"chop_down_if_statement_long"
/>
<option
name=
"ITERATION_ELEMENTS_WRAPPING"
value=
"chop_down_if_not_single"
/>
</formatting-settings>
</DBN-SQL>
</code_scheme>
</component>
\ No newline at end of file
libs/es.py
View file @
1e2e7b19
...
...
@@ -415,6 +415,7 @@ class ESPerform(object):
},
"sort"
:
[
{
"_score"
:
{
"order"
:
"desc"
}},
# {"latest_reply_time":{"order": "desc"}},
{
"create_time_val"
:
{
"order"
:
"desc"
}},
{
"language_type"
:
{
"order"
:
"asc"
}},
],
...
...
trans2es/mapping/topic-high-star.json
View file @
1e2e7b19
...
...
@@ -17,6 +17,7 @@
"user_nick_name_pre"
:
{
"type"
:
"text"
,
"analyzer"
:
"keyword"
},
//不切词的用户名
"group_id"
:{
"type"
:
"long"
},
//所在组ID
"tag_list"
:{
"type"
:
"long"
},
//标签属性
"latest_reply_time"
:{
"type"
:
"date"
,
"format"
:
"date_time_no_millis"
},
"useful_tag_list"
:{
"type"
:
"long"
},
//有用标签属性
"edit_tag_list"
:{
"type"
:
"long"
},
//编辑标签
"tag_name_list"
:{
"type"
:
"text"
,
"analyzer"
:
"gm_default_index"
,
"search_analyzer"
:
"gm_default_index"
},
...
...
trans2es/mapping/topic-star-routing.json
View file @
1e2e7b19
...
...
@@ -18,6 +18,7 @@
"group_id"
:{
"type"
:
"long"
},
//所在组ID
"tag_list"
:{
"type"
:
"long"
},
//标签属性
"useful_tag_list"
:{
"type"
:
"long"
},
//有用标签属性
"latest_reply_time"
:{
"type"
:
"date"
,
"format"
:
"date_time_no_millis"
},
"edit_tag_list"
:{
"type"
:
"long"
},
//编辑标签
"tag_name_list"
:{
"type"
:
"text"
,
"analyzer"
:
"gm_default_index"
,
"search_analyzer"
:
"gm_default_index"
},
"share_num"
:{
"type"
:
"long"
},
...
...
trans2es/mapping/topic-star.json
View file @
1e2e7b19
...
...
@@ -18,6 +18,7 @@
"group_id"
:{
"type"
:
"long"
},
//所在组ID
"tag_list"
:{
"type"
:
"long"
},
//标签属性
"useful_tag_list"
:{
"type"
:
"long"
},
//有用标签属性
"latest_reply_time"
:{
"type"
:
"date"
,
"format"
:
"date_time_no_millis"
},
"edit_tag_list"
:{
"type"
:
"long"
},
//编辑标签
"tag_name_list"
:{
"type"
:
"text"
,
"analyzer"
:
"gm_default_index"
,
"search_analyzer"
:
"gm_default_index"
},
"share_num"
:{
"type"
:
"long"
},
...
...
trans2es/mapping/topic.json
View file @
1e2e7b19
...
...
@@ -17,6 +17,7 @@
"user_nick_name_pre"
:
{
"type"
:
"text"
,
"analyzer"
:
"keyword"
},
//不切词的用户名
"group_id"
:{
"type"
:
"long"
},
//所在组ID
"tag_list"
:{
"type"
:
"long"
},
//标签属性
"latest_reply_time"
:{
"type"
:
"date"
,
"format"
:
"date_time_no_millis"
},
"useful_tag_list"
:{
"type"
:
"long"
},
//有用标签属性
"edit_tag_list"
:{
"type"
:
"long"
},
//编辑标签
"tag_name_list"
:{
"type"
:
"text"
,
"analyzer"
:
"gm_default_index"
,
"search_analyzer"
:
"gm_default_index"
},
...
...
trans2es/models/topic.py
View file @
1e2e7b19
...
...
@@ -313,6 +313,27 @@ class Topic(models.Model):
logging
.
error
(
"catch exception,err_msg:
%
s"
%
traceback
.
format_exc
())
return
[]
def
get_latest_reply_date
(
self
):
try
:
reply_query_results
=
Reply
.
objects
.
using
(
settings
.
SLAVE_DB_NAME
)
.
filter
(
topic_id
=
self
.
id
,
is_deleted
=
0
,
is_online
=
1
)
.
values
(
"user_id"
,
"create_time"
)
datetime_list
=
list
()
if
reply_query_results
.
count
()
>
0
:
for
reply
in
reply_query_results
:
UserExtra_results
=
UserExtra
.
objects
.
using
(
settings
.
SLAVE_DB_NAME
)
.
filter
(
user_id
=
reply
[
'user_id'
])
.
values
(
'is_shadow'
)
if
UserExtra_results
.
count
()
>
0
:
if
not
UserExtra_results
[
0
][
'is_shadow'
]:
datetime_list
.
append
(
reply
[
'create_time'
])
dt
=
max
(
datetime_list
)
return
datetime
.
datetime
(
dt
.
year
,
dt
.
month
,
dt
.
day
,
dt
.
hour
,
dt
.
minute
,
dt
.
second
,
tzinfo
=
datetime
.
timezone
(
datetime
.
timedelta
(
hours
=
8
)))
else
:
return
datetime
.
datetime
(
1980
,
1
,
1
,
0
,
0
,
0
,
tzinfo
=
datetime
.
timezone
(
datetime
.
timedelta
(
hours
=
8
)))
except
:
return
datetime
.
datetime
(
1980
,
1
,
1
,
0
,
0
,
0
,
tzinfo
=
datetime
.
timezone
(
datetime
.
timedelta
(
hours
=
8
)))
class
TopicComplaint
(
models
.
Model
):
"""帖子举报"""
...
...
@@ -384,3 +405,17 @@ class TopicBillBoard(models.Model):
pictorial_id
=
models
.
IntegerField
(
verbose_name
=
u"榜单ID"
)
real_vote_cnt
=
models
.
IntegerField
(
verbose_name
=
u"真实赞"
)
virt_vote_cnt
=
models
.
IntegerField
(
verbose_name
=
u"虚拟赞"
)
class
Reply
(
models
.
Model
):
"""帖子回复"""
class
Meta
:
verbose_name
=
"帖子回复"
db_table
=
"reply"
topic_id
=
models
.
IntegerField
(
verbose_name
=
u"帖子ID"
)
user_id
=
models
.
IntegerField
(
verbose_name
=
u'用户ID'
)
create_time
=
models
.
DateTimeField
(
verbose_name
=
u'创建时间'
)
is_deleted
=
models
.
BooleanField
(
verbose_name
=
u'是否删除'
)
is_online
=
models
.
BooleanField
(
verbose_name
=
u'是否上线'
)
trans2es/utils/topic_transfer.py
View file @
1e2e7b19
...
...
@@ -78,6 +78,9 @@ class TopicTransfer(object):
# begin = time.time()
topic_useful_tag_id_list
=
instance
.
get_topic_useful_tag_id_list
()
res
[
"useful_tag_list"
]
=
topic_useful_tag_id_list
latest_reply_time
=
instance
.
get_latest_reply_date
()
res
[
"latest_reply_time"
]
=
latest_reply_time
# end = time.time()
# time5 = (end - begin)
# # 片假名
...
...
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