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
钟尚武
physical
Commits
5b7e49a7
Commit
5b7e49a7
authored
Dec 19, 2018
by
段英荣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
modify
parent
5d5b5528
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
36 additions
and
2 deletions
+36
-2
tag.json
trans2es/mapping/tag.json
+1
-0
tag.py
trans2es/models/tag.py
+29
-1
tag_transfer.py
trans2es/utils/tag_transfer.py
+6
-1
No files found.
trans2es/mapping/tag.json
View file @
5b7e49a7
...
...
@@ -4,6 +4,7 @@
"id"
:{
"type"
:
"long"
},
"suggest"
:{
"type"
:
"completion"
},
"name"
:{
"type"
:
"text"
,
"analyzer"
:
"gm_default_index"
,
"search_analyzer"
:
"gm_default_index"
},
"tag_type"
:{
"type"
:
"long"
},
"is_online"
:{
"type"
:
"boolean"
},
//上线
"is_deleted"
:{
"type"
:
"boolean"
},
"near_new_topic_num"
:{
"type"
:
"long"
}
...
...
trans2es/models/tag.py
View file @
5b7e49a7
...
...
@@ -21,7 +21,6 @@ class TopicTag(models.Model):
is_online
=
models
.
BooleanField
(
verbose_name
=
u"是否在线"
)
class
AccountUserTag
(
models
.
Model
):
class
Meta
:
verbose_name
=
u"用户标签"
...
...
@@ -48,3 +47,32 @@ class Tag(models.Model):
icon_url
=
models
.
CharField
(
verbose_name
=
u"icon_url"
,
max_length
=
120
)
create_time
=
models
.
DateTimeField
(
verbose_name
=
u'创建时间'
,
default
=
datetime
.
datetime
.
fromtimestamp
(
0
))
update_time
=
models
.
DateTimeField
(
verbose_name
=
u'更新时间'
,
default
=
datetime
.
datetime
.
fromtimestamp
(
0
))
class
CommunityTagTypeRelation
(
models
.
Model
):
class
Meta
:
verbose_name
=
u"标签类型对应关系"
db_table
=
"community_tag_type_relation"
id
=
models
.
IntegerField
(
primary_key
=
True
,
verbose_name
=
u"主键ID"
)
is_deleted
=
models
.
BooleanField
(
verbose_name
=
u"是否删除"
)
is_online
=
models
.
BooleanField
(
verbose_name
=
u"是否上线"
)
tag_id
=
models
.
IntegerField
(
verbose_name
=
u"标签ID"
)
tag_type_id
=
models
.
IntegerField
(
verbose_name
=
u"标签类型ID"
)
create_time
=
models
.
DateTimeField
(
verbose_name
=
u'创建时间'
,
default
=
datetime
.
datetime
.
fromtimestamp
(
0
))
update_time
=
models
.
DateTimeField
(
verbose_name
=
u'更新时间'
,
default
=
datetime
.
datetime
.
fromtimestamp
(
0
))
class
CommunityTagType
(
models
.
Model
):
class
Meta
:
verbose_name
=
u"标签类型"
db_table
=
"community_tag_type"
id
=
models
.
IntegerField
(
primary_key
=
True
,
verbose_name
=
u"主键ID"
)
is_deleted
=
models
.
BooleanField
(
verbose_name
=
u"是否删除"
)
is_online
=
models
.
BooleanField
(
verbose_name
=
u"是否上线"
)
name
=
models
.
CharField
(
verbose_name
=
u"名称"
,
max_length
=
64
)
create_time
=
models
.
DateTimeField
(
verbose_name
=
u'创建时间'
,
default
=
datetime
.
datetime
.
fromtimestamp
(
0
))
update_time
=
models
.
DateTimeField
(
verbose_name
=
u'更新时间'
,
default
=
datetime
.
datetime
.
fromtimestamp
(
0
))
trans2es/utils/tag_transfer.py
View file @
5b7e49a7
...
...
@@ -6,7 +6,7 @@ import logging
import
traceback
from
libs.tools
import
tzlc
from
trans2es.models.topic
import
Topic
from
trans2es.models.tag
import
TopicTag
from
trans2es.models.tag
import
TopicTag
,
CommunityTagType
,
CommunityTagTypeRelation
import
datetime
class
TagTransfer
(
object
):
...
...
@@ -35,6 +35,11 @@ class TagTransfer(object):
res
[
"near_new_topic_num"
]
=
topic_num
res
[
"tag_type"
]
=
-
1
tag_type_id
=
CommunityTagTypeRelation
.
objects
.
filter
(
tag_id
=
instance
.
id
,
is_online
=
True
,
is_deleted
=
False
)
.
values_list
(
"tag_type_id"
)
if
tag_type_id
:
res
[
"tag_type"
]
=
tag_type_id
return
res
except
:
logging
.
error
(
"catch exception,err_msg:
%
s"
%
traceback
.
format_exc
())
...
...
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