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
c10eb54e
Commit
c10eb54e
authored
Apr 04, 2019
by
王浩
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'test' of
http://git.wanmeizhensuo.com/alpha/physical
into haow/dev
parents
fafb0d5c
098cb767
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
90 additions
and
37 deletions
+90
-37
workspace.xml
.idea/workspace.xml
+54
-35
topic.py
search/utils/topic.py
+12
-0
group.py
search/views/group.py
+0
-2
topic.json
trans2es/mapping/topic.json
+1
-0
topic.py
trans2es/models/topic.py
+21
-0
topic_transfer.py
trans2es/utils/topic_transfer.py
+2
-0
No files found.
.idea/workspace.xml
View file @
c10eb54e
...
@@ -3,6 +3,7 @@
...
@@ -3,6 +3,7 @@
<component
name=
"ChangeListManager"
>
<component
name=
"ChangeListManager"
>
<list
default=
"true"
id=
"d7dd36ca-85ef-4a59-9db5-8b1ee4993a4e"
name=
"Default Changelist"
comment=
""
>
<list
default=
"true"
id=
"d7dd36ca-85ef-4a59-9db5-8b1ee4993a4e"
name=
"Default Changelist"
comment=
""
>
<change
beforePath=
"$PROJECT_DIR$/.idea/workspace.xml"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/.idea/workspace.xml"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/.idea/workspace.xml"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/.idea/workspace.xml"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/trans2es/models/topic.py"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/trans2es/models/topic.py"
afterDir=
"false"
/>
</list>
</list>
<option
name=
"EXCLUDED_CONVERTED_TO_IGNORED"
value=
"true"
/>
<option
name=
"EXCLUDED_CONVERTED_TO_IGNORED"
value=
"true"
/>
<option
name=
"SHOW_DIALOG"
value=
"false"
/>
<option
name=
"SHOW_DIALOG"
value=
"false"
/>
...
@@ -55,35 +56,44 @@
...
@@ -55,35 +56,44 @@
</counts>
</counts>
</usages-collector>
</usages-collector>
</session>
</session>
<session
id=
"-609148713"
>
<usages-collector
id=
"statistics.file.extensions.edit"
>
<counts>
<entry
key=
"py"
value=
"3"
/>
</counts>
</usages-collector>
<usages-collector
id=
"statistics.file.types.edit"
>
<counts>
<entry
key=
"Python"
value=
"3"
/>
</counts>
</usages-collector>
</session>
</component>
</component>
<component
name=
"FileEditorManager"
>
<component
name=
"FileEditorManager"
>
<leaf
SIDE_TABS_SIZE_LIMIT_KEY=
"300"
>
<leaf>
<file
pinned=
"false"
current-in-tab=
"false"
>
<file
pinned=
"false"
current-in-tab=
"false"
>
<entry
file=
"file://$PROJECT_DIR$/
search/views/topic.py
"
>
<entry
file=
"file://$PROJECT_DIR$/
trans2es/mapping/topic.json
"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"209"
>
<state
relative-caret-position=
"105"
>
<caret
line=
"85"
column=
"46"
selection-start-line=
"85"
selection-start-column=
"46"
selection-end-line=
"85"
selection-end-column=
"46"
/>
<caret
line=
"7"
column=
"19"
selection-start-line=
"7"
selection-start-column=
"5"
selection-end-line=
"7"
selection-end-column=
"19"
/>
<folding>
<element
signature=
"e#463#1573#0"
/>
<element
signature=
"e#6049#6240#0"
/>
<element
signature=
"e#7051#7614#0"
/>
<element
signature=
"e#8492#10033#0"
/>
<element
signature=
"e#10162#10820#0"
/>
<element
signature=
"e#10934#11363#0"
/>
</folding>
</state>
</state>
</provider>
</provider>
</entry>
</entry>
</file>
</file>
<file
pinned=
"false"
current-in-tab=
"true"
>
<file
pinned=
"false"
current-in-tab=
"true"
>
<entry
file=
"file://$PROJECT_DIR$/search/utils/topic.py"
>
<entry
file=
"file://$PROJECT_DIR$/trans2es/models/topic.py"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"270"
>
<caret
line=
"256"
column=
"35"
selection-start-line=
"256"
selection-start-column=
"35"
selection-end-line=
"256"
selection-end-column=
"35"
/>
</state>
</provider>
</entry>
</file>
<file
pinned=
"false"
current-in-tab=
"false"
>
<entry
file=
"file://$PROJECT_DIR$/trans2es/utils/topic_transfer.py"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"1760"
>
<state
relative-caret-position=
"243"
>
<caret
line=
"293"
column=
"66"
selection-start-line=
"293"
selection-start-column=
"66"
selection-end-line=
"293"
selection-end-column=
"66"
/>
<caret
line=
"112"
selection-start-line=
"112"
selection-end-line=
"112"
/>
<folding>
<element
signature=
"e#47#61#0"
expanded=
"true"
/>
<element
signature=
"e#363#1043#0"
/>
</folding>
</state>
</state>
</provider>
</provider>
</entry>
</entry>
...
@@ -101,14 +111,14 @@
...
@@ -101,14 +111,14 @@
<option
value=
"$PROJECT_DIR$/search/views/topic.py"
/>
<option
value=
"$PROJECT_DIR$/search/views/topic.py"
/>
<option
value=
"$PROJECT_DIR$/search/utils/topic.py"
/>
<option
value=
"$PROJECT_DIR$/search/utils/topic.py"
/>
<option
value=
"$PROJECT_DIR$/physical/settings.py"
/>
<option
value=
"$PROJECT_DIR$/physical/settings.py"
/>
<option
value=
"$PROJECT_DIR$/trans2es/models/topic.py"
/>
</list>
</list>
</option>
</option>
</component>
</component>
<component
name=
"ProjectFrameBounds"
>
<component
name=
"ProjectFrameBounds"
extendedState=
"1"
>
<option
name=
"x"
value=
"279"
/>
<option
name=
"y"
value=
"23"
/>
<option
name=
"y"
value=
"23"
/>
<option
name=
"width"
value=
"1280"
/>
<option
name=
"width"
value=
"1280"
/>
<option
name=
"height"
value=
"7
38
"
/>
<option
name=
"height"
value=
"7
24
"
/>
</component>
</component>
<component
name=
"ProjectInspectionProfilesVisibleTreeState"
>
<component
name=
"ProjectInspectionProfilesVisibleTreeState"
>
<entry
key=
"Project Default"
>
<entry
key=
"Project Default"
>
...
@@ -140,11 +150,6 @@
...
@@ -140,11 +150,6 @@
<item
name=
"physical"
type=
"b2602c69:ProjectViewProjectNode"
/>
<item
name=
"physical"
type=
"b2602c69:ProjectViewProjectNode"
/>
<item
name=
"physical"
type=
"462c0819:PsiDirectoryNode"
/>
<item
name=
"physical"
type=
"462c0819:PsiDirectoryNode"
/>
</path>
</path>
<path>
<item
name=
"physical"
type=
"b2602c69:ProjectViewProjectNode"
/>
<item
name=
"physical"
type=
"462c0819:PsiDirectoryNode"
/>
<item
name=
"linucb"
type=
"462c0819:PsiDirectoryNode"
/>
</path>
<path>
<path>
<item
name=
"physical"
type=
"b2602c69:ProjectViewProjectNode"
/>
<item
name=
"physical"
type=
"b2602c69:ProjectViewProjectNode"
/>
<item
name=
"physical"
type=
"462c0819:PsiDirectoryNode"
/>
<item
name=
"physical"
type=
"462c0819:PsiDirectoryNode"
/>
...
@@ -153,19 +158,19 @@
...
@@ -153,19 +158,19 @@
<path>
<path>
<item
name=
"physical"
type=
"b2602c69:ProjectViewProjectNode"
/>
<item
name=
"physical"
type=
"b2602c69:ProjectViewProjectNode"
/>
<item
name=
"physical"
type=
"462c0819:PsiDirectoryNode"
/>
<item
name=
"physical"
type=
"462c0819:PsiDirectoryNode"
/>
<item
name=
"
search
"
type=
"462c0819:PsiDirectoryNode"
/>
<item
name=
"
trans2es
"
type=
"462c0819:PsiDirectoryNode"
/>
</path>
</path>
<path>
<path>
<item
name=
"physical"
type=
"b2602c69:ProjectViewProjectNode"
/>
<item
name=
"physical"
type=
"b2602c69:ProjectViewProjectNode"
/>
<item
name=
"physical"
type=
"462c0819:PsiDirectoryNode"
/>
<item
name=
"physical"
type=
"462c0819:PsiDirectoryNode"
/>
<item
name=
"
search
"
type=
"462c0819:PsiDirectoryNode"
/>
<item
name=
"
trans2es
"
type=
"462c0819:PsiDirectoryNode"
/>
<item
name=
"
uti
ls"
type=
"462c0819:PsiDirectoryNode"
/>
<item
name=
"
mode
ls"
type=
"462c0819:PsiDirectoryNode"
/>
</path>
</path>
<path>
<path>
<item
name=
"physical"
type=
"b2602c69:ProjectViewProjectNode"
/>
<item
name=
"physical"
type=
"b2602c69:ProjectViewProjectNode"
/>
<item
name=
"physical"
type=
"462c0819:PsiDirectoryNode"
/>
<item
name=
"physical"
type=
"462c0819:PsiDirectoryNode"
/>
<item
name=
"
search
"
type=
"462c0819:PsiDirectoryNode"
/>
<item
name=
"
trans2es
"
type=
"462c0819:PsiDirectoryNode"
/>
<item
name=
"
view
s"
type=
"462c0819:PsiDirectoryNode"
/>
<item
name=
"
util
s"
type=
"462c0819:PsiDirectoryNode"
/>
</path>
</path>
</expand>
</expand>
<select
/>
<select
/>
...
@@ -208,9 +213,9 @@
...
@@ -208,9 +213,9 @@
<servers
/>
<servers
/>
</component>
</component>
<component
name=
"ToolWindowManager"
>
<component
name=
"ToolWindowManager"
>
<frame
x=
"0"
y=
"23"
width=
"1280"
height=
"724"
extended-state=
"
6
"
/>
<frame
x=
"0"
y=
"23"
width=
"1280"
height=
"724"
extended-state=
"
1
"
/>
<layout>
<layout>
<window_info
content_ui=
"combo"
id=
"Project"
order=
"0"
visible=
"true"
weight=
"0.2
2160445
"
/>
<window_info
content_ui=
"combo"
id=
"Project"
order=
"0"
visible=
"true"
weight=
"0.2
494043
"
/>
<window_info
id=
"Structure"
order=
"1"
side_tool=
"true"
weight=
"0.25"
/>
<window_info
id=
"Structure"
order=
"1"
side_tool=
"true"
weight=
"0.25"
/>
<window_info
id=
"DB Browser"
order=
"2"
/>
<window_info
id=
"DB Browser"
order=
"2"
/>
<window_info
id=
"Favorites"
order=
"3"
side_tool=
"true"
/>
<window_info
id=
"Favorites"
order=
"3"
side_tool=
"true"
/>
...
@@ -223,7 +228,7 @@
...
@@ -223,7 +228,7 @@
<window_info
anchor=
"bottom"
id=
"TODO"
order=
"6"
/>
<window_info
anchor=
"bottom"
id=
"TODO"
order=
"6"
/>
<window_info
anchor=
"bottom"
id=
"Version Control"
order=
"7"
show_stripe_button=
"false"
/>
<window_info
anchor=
"bottom"
id=
"Version Control"
order=
"7"
show_stripe_button=
"false"
/>
<window_info
anchor=
"bottom"
id=
"DB Execution Console"
order=
"8"
/>
<window_info
anchor=
"bottom"
id=
"DB Execution Console"
order=
"8"
/>
<window_info
active=
"true"
anchor=
"bottom"
id=
"Terminal"
order=
"9"
visible=
"true"
weight=
"0.
44663382
"
/>
<window_info
active=
"true"
anchor=
"bottom"
id=
"Terminal"
order=
"9"
visible=
"true"
weight=
"0.
16420361
"
/>
<window_info
anchor=
"bottom"
id=
"Python Console"
order=
"10"
/>
<window_info
anchor=
"bottom"
id=
"Python Console"
order=
"10"
/>
<window_info
anchor=
"bottom"
id=
"Event Log"
order=
"11"
side_tool=
"true"
/>
<window_info
anchor=
"bottom"
id=
"Event Log"
order=
"11"
side_tool=
"true"
/>
<window_info
anchor=
"right"
id=
"Commander"
internal_type=
"SLIDING"
order=
"0"
type=
"SLIDING"
weight=
"0.4"
/>
<window_info
anchor=
"right"
id=
"Commander"
internal_type=
"SLIDING"
order=
"0"
type=
"SLIDING"
weight=
"0.4"
/>
...
@@ -293,6 +298,20 @@
...
@@ -293,6 +298,20 @@
</state>
</state>
</provider>
</provider>
</entry>
</entry>
<entry
file=
"file://$PROJECT_DIR$/trans2es/mapping/topic.json"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"105"
>
<caret
line=
"7"
column=
"19"
selection-start-line=
"7"
selection-start-column=
"5"
selection-end-line=
"7"
selection-end-column=
"19"
/>
</state>
</provider>
</entry>
<entry
file=
"file://$PROJECT_DIR$/trans2es/models/topic.py"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"270"
>
<caret
line=
"256"
column=
"35"
selection-start-line=
"256"
selection-start-column=
"35"
selection-end-line=
"256"
selection-end-column=
"35"
/>
</state>
</provider>
</entry>
</component>
</component>
<component
name=
"masterDetails"
>
<component
name=
"masterDetails"
>
<states>
<states>
...
...
search/utils/topic.py
View file @
c10eb54e
...
@@ -747,6 +747,18 @@ class TopicUtils(object):
...
@@ -747,6 +747,18 @@ class TopicUtils(object):
"order"
:
"desc"
"order"
:
"desc"
},
},
})
})
elif
sort_by
==
TOPIC_SEARCH_SORT
.
VOTE_NUM_AEC
:
sort_rule
.
append
({
"total_vote_num"
:
{
"order"
:
"asc"
},
})
elif
sort_by
==
TOPIC_SEARCH_SORT
.
VOTE_NUM_DESC
:
sort_rule
.
append
({
"total_vote_num"
:
{
"order"
:
"desc"
},
})
return
sort_rule
return
sort_rule
...
...
search/views/group.py
View file @
c10eb54e
...
@@ -92,8 +92,6 @@ def pictorial_topic(topic_id=-1, offset=0, size=10):
...
@@ -92,8 +92,6 @@ def pictorial_topic(topic_id=-1, offset=0, size=10):
:return:
:return:
"""
"""
try
:
try
:
if
not
isinstance
(
topic_id
,
int
):
user_id
=
-
1
# 获取es链接对象
# 获取es链接对象
es_cli_obj
=
ESPerform
.
get_cli
()
es_cli_obj
=
ESPerform
.
get_cli
()
...
...
trans2es/mapping/topic.json
View file @
c10eb54e
...
@@ -5,6 +5,7 @@
...
@@ -5,6 +5,7 @@
"is_online"
:{
"type"
:
"boolean"
},
//上线
"is_online"
:{
"type"
:
"boolean"
},
//上线
"is_deleted"
:{
"type"
:
"boolean"
},
"is_deleted"
:{
"type"
:
"boolean"
},
"vote_num"
:{
"type"
:
"long"
},
"vote_num"
:{
"type"
:
"long"
},
"total_vote_num"
:{
"type"
:
"long"
},
"reply_num"
:{
"type"
:
"long"
},
"reply_num"
:{
"type"
:
"long"
},
"name"
:{
"type"
:
"text"
,
"analyzer"
:
"gm_default_index"
,
"search_analyzer"
:
"gm_default_index"
},
"name"
:{
"type"
:
"text"
,
"analyzer"
:
"gm_default_index"
,
"search_analyzer"
:
"gm_default_index"
},
"description"
:{
"type"
:
"text"
,
"analyzer"
:
"gm_default_index"
,
"search_analyzer"
:
"gm_default_index"
},
"description"
:{
"type"
:
"text"
,
"analyzer"
:
"gm_default_index"
,
"search_analyzer"
:
"gm_default_index"
},
...
...
trans2es/models/topic.py
View file @
c10eb54e
...
@@ -82,6 +82,14 @@ class Topic(models.Model):
...
@@ -82,6 +82,14 @@ 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_virtual_vote_num
(
self
):
try
:
topic_extra
=
TopicExtra
.
object
.
get
(
topic_id
=
self
.
id
)
return
topic_extra
.
virtual_vote_num
except
:
return
0
def
get_pictorial_id
(
self
):
def
get_pictorial_id
(
self
):
try
:
try
:
pictorial_id_list
=
[]
pictorial_id_list
=
[]
...
@@ -238,3 +246,16 @@ class PictorialTopic(models.Model):
...
@@ -238,3 +246,16 @@ class PictorialTopic(models.Model):
is_online
=
models
.
BooleanField
(
verbose_name
=
u"是否有效"
,
default
=
True
)
is_online
=
models
.
BooleanField
(
verbose_name
=
u"是否有效"
,
default
=
True
)
is_online
=
models
.
BooleanField
(
verbose_name
=
u'是否上线'
)
is_online
=
models
.
BooleanField
(
verbose_name
=
u'是否上线'
)
is_deleted
=
models
.
BooleanField
(
verbose_name
=
u'是否删除'
)
is_deleted
=
models
.
BooleanField
(
verbose_name
=
u'是否删除'
)
class
TopicExtra
(
models
.
Model
):
"""帖子相关额外信息"""
class
Meta
:
verbose_name
=
'帖子额外信息'
app_label
=
'community'
db_table
=
'topic_extra'
waq
id
=
models
.
IntegerField
(
verbose_name
=
u'ID'
,
primary_key
=
True
)
topic_id
=
models
.
IntegerField
(
verbose_name
=
u"帖子ID"
,
db_index
=
True
)
virtual_vote_num
=
models
.
IntegerField
(
verbose_name
=
"帖子虚拟点赞"
)
trans2es/utils/topic_transfer.py
View file @
c10eb54e
...
@@ -109,6 +109,8 @@ class TopicTransfer(object):
...
@@ -109,6 +109,8 @@ class TopicTransfer(object):
res
[
"update_time"
]
=
tzlc_update_time
res
[
"update_time"
]
=
tzlc_update_time
res
[
"update_time_val"
]
=
int
(
time
.
mktime
(
tzlc_update_time
.
timetuple
()))
res
[
"update_time_val"
]
=
int
(
time
.
mktime
(
tzlc_update_time
.
timetuple
()))
res
[
"total_vote_num"
]
=
instance
.
get_virtual_vote_num
()
+
instance
.
vote_num
logging
.
info
(
"test topic transfer time cost,time0:
%
d,time1:
%
d,time2:
%
d,time3:
%
d,time4:
%
d"
%
(
time0
,
time1
,
time2
,
time3
,
time4
))
logging
.
info
(
"test topic transfer time cost,time0:
%
d,time1:
%
d,time2:
%
d,time3:
%
d,time4:
%
d"
%
(
time0
,
time1
,
time2
,
time3
,
time4
))
return
res
return
res
except
:
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