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
09ad4446
Commit
09ad4446
authored
Nov 27, 2018
by
段英荣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
modify
parent
f2799640
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
83 additions
and
18 deletions
+83
-18
topic.json
trans2es/mapping/topic.json
+1
-0
user.json
trans2es/mapping/user.json
+1
-1
group.py
trans2es/models/group.py
+0
-1
group_user_role.py
trans2es/models/group_user_role.py
+0
-2
pick_celebrity.py
trans2es/models/pick_celebrity.py
+0
-1
pick_topic.py
trans2es/models/pick_topic.py
+0
-1
pickuserrecord.py
trans2es/models/pickuserrecord.py
+0
-2
tag.py
trans2es/models/tag.py
+49
-0
topic.py
trans2es/models/topic.py
+16
-4
user.py
trans2es/models/user.py
+14
-3
user_follow.py
trans2es/models/user_follow.py
+0
-2
topic_transfer.py
trans2es/utils/topic_transfer.py
+1
-0
user_transfer.py
trans2es/utils/user_transfer.py
+1
-1
No files found.
trans2es/mapping/topic.json
View file @
09ad4446
...
...
@@ -10,6 +10,7 @@
"content"
:{
"type"
:
"text"
},
"content_level"
:{
"type"
:
"text"
},
"user_id"
:{
"type"
:
"long"
},
"tag_list"
:{
"type"
:
"long"
},
//标签属性
"share_num"
:{
"type"
:
"long"
},
"pick_id_list"
:{
"type"
:
"long"
},
"create_time"
:{
"type"
:
"date"
,
"format"
:
"date_time_no_millis"
},
...
...
trans2es/mapping/user.json
View file @
09ad4446
...
...
@@ -7,7 +7,7 @@
"profile_pic"
:{
"type"
:
"text"
},
//头像
"gender"
:{
"type"
:
"integer"
},
"is_online"
:{
"type"
:
"boolean"
},
//是否上线
"tag_list"
:{
"type"
:
"
text
"
},
//标签属性
"tag_list"
:{
"type"
:
"
long
"
},
//标签属性
"city_id"
:{
"type"
:
"long"
},
"country_id"
:{
"type"
:
"long"
},
"attention_user_id_list"
:{
//关注用户列表
...
...
trans2es/models/group.py
View file @
09ad4446
...
...
@@ -12,7 +12,6 @@ import datetime
class
Group
(
models
.
Model
):
class
Meta
:
verbose_name
=
u'小组'
app_label
=
'community'
db_table
=
'group'
name
=
models
.
CharField
(
verbose_name
=
u'名称'
,
max_length
=
100
,
default
=
''
)
...
...
trans2es/models/group_user_role.py
View file @
09ad4446
...
...
@@ -13,9 +13,7 @@ from .group import Group
class
GroupUserRole
(
models
.
Model
):
class
Meta
:
verbose_name
=
u'group_user_role'
verbose_name_plural
=
u'group_user_role'
db_table
=
'group_user_role'
app_label
=
'api'
user_id
=
models
.
BigIntegerField
(
verbose_name
=
u'用户ID'
)
group
=
models
.
ForeignKey
(
...
...
trans2es/models/pick_celebrity.py
View file @
09ad4446
...
...
@@ -14,7 +14,6 @@ class PickCelebrity(models.Model):
class
Meta
:
verbose_name
=
u"pick明星"
db_table
=
u"pickcelebrity"
app_label
=
"api"
id
=
models
.
IntegerField
(
primary_key
=
True
,
verbose_name
=
u"主键ID"
)
celebrity_id
=
models
.
IntegerField
(
verbose_name
=
u"明星ID"
)
...
...
trans2es/models/pick_topic.py
View file @
09ad4446
...
...
@@ -13,7 +13,6 @@ class PickTopic(models.Model):
class
Meta
:
verbose_name
=
u"pick帖子"
db_table
=
u"picktopic"
app_label
=
"api"
id
=
models
.
IntegerField
(
primary_key
=
True
,
verbose_name
=
u"主键ID"
)
topic_id
=
models
.
IntegerField
(
verbose_name
=
u"帖子ID"
)
...
...
trans2es/models/pickuserrecord.py
View file @
09ad4446
...
...
@@ -13,9 +13,7 @@ from .user import User
class
PickUserRecord
(
models
.
Model
):
class
Meta
:
verbose_name
=
u'用户之间pick'
verbose_name_plural
=
u'pickuserrecord'
db_table
=
'pickuserrecord'
app_label
=
'api'
pickuser_id
=
models
.
IntegerField
(
verbose_name
=
"pick user id"
)
is_deleted
=
models
.
BooleanField
(
verbose_name
=
"是否删除"
)
...
...
trans2es/models/tag.py
0 → 100644
View file @
09ad4446
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from
django.conf
import
settings
from
django.core.management.base
import
BaseCommand
,
CommandError
import
traceback
import
logging
from
libs.es
import
ESPerform
from
django.db
import
models
import
datetime
class
TopicTag
(
models
.
Model
):
class
Meta
:
verbose_name
=
u"帖子标签"
db_table
=
"community_topictag"
id
=
models
.
IntegerField
(
primary_key
=
True
,
verbose_name
=
u"主键ID"
)
tag_id
=
models
.
IntegerField
(
verbose_name
=
u"标签ID"
)
topic_id
=
models
.
IntegerField
(
verbose_name
=
u"帖子ID"
)
is_online
=
models
.
BooleanField
(
verbose_name
=
u"是否在线"
)
class
AccountUserTag
(
models
.
Model
):
class
Meta
:
verbose_name
=
u"用户标签"
db_table
=
"account_user_tag"
id
=
models
.
IntegerField
(
primary_key
=
True
,
verbose_name
=
u"主键ID"
)
tag_id
=
models
.
IntegerField
(
verbose_name
=
u"标签ID"
)
user_id
=
models
.
IntegerField
(
verbose_name
=
u"用户ID"
)
is_deleted
=
models
.
BooleanField
(
verbose_name
=
u"是否删除"
)
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
Tag
(
models
.
Model
):
class
Meta
:
verbose_name
=
u"标签"
db_table
=
"community_tag"
id
=
models
.
IntegerField
(
primary_key
=
True
,
verbose_name
=
u"主键ID"
)
is_deleted
=
models
.
BooleanField
(
verbose_name
=
u"是否删除"
)
name
=
models
.
CharField
(
verbose_name
=
u"标签名称"
)
description
=
models
.
CharField
(
verbose_name
=
u"标签描述"
)
icon_url
=
models
.
CharField
(
verbose_name
=
u"icon_url"
)
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/models/topic.py
View file @
09ad4446
...
...
@@ -9,17 +9,14 @@ from libs.es import ESPerform
from
django.db
import
models
import
datetime
from
.pick_topic
import
PickTopic
from
.tag
import
TopicTag
class
Topic
(
models
.
Model
):
class
Meta
:
verbose_name
=
u'日记'
verbose_name_plural
=
u'日记'
db_table
=
'topic'
app_label
=
'api'
id
=
models
.
IntegerField
(
verbose_name
=
'日记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
))
name
=
models
.
CharField
(
verbose_name
=
'日记名称'
)
group_id
=
models
.
IntegerField
(
verbose_name
=
'用户所在组ID'
)
user_id
=
models
.
IntegerField
(
verbose_name
=
'用户ID'
)
...
...
@@ -32,6 +29,8 @@ class Topic(models.Model):
is_online
=
models
.
BooleanField
(
verbose_name
=
'是否上线'
)
is_deleted
=
models
.
BooleanField
(
verbose_name
=
'是否删除'
)
content_level
=
models
.
CharField
(
verbose_name
=
'内容等级'
)
create_time
=
models
.
DateTimeField
(
verbose_name
=
u'日记创建时间'
,
default
=
datetime
.
datetime
.
fromtimestamp
(
0
))
update_time
=
models
.
DateTimeField
(
verbose_name
=
u'日记更新时间'
,
default
=
datetime
.
datetime
.
fromtimestamp
(
0
))
def
get_pick_id_info
(
self
):
...
...
@@ -46,3 +45,15 @@ class Topic(models.Model):
logging
.
error
(
"catch exception,err_msg:
%
s"
%
traceback
.
format_exc
())
return
()
def
get_topic_tag_id_list
(
self
):
try
:
topic_tag_id_list
=
list
()
query_results
=
TopicTag
.
objects
.
get
(
topic_id
=
self
.
id
)
for
item
in
query_results
:
topic_tag_id_list
.
append
(
item
.
tag_id
)
return
topic_tag_id_list
except
:
logging
.
error
(
"catch exception,err_msg:
%
s"
%
traceback
.
format_exc
())
return
None
\ No newline at end of file
trans2es/models/user.py
View file @
09ad4446
...
...
@@ -9,14 +9,12 @@ from libs.es import ESPerform
from
django.db
import
models
import
datetime
from
.group_user_role
import
GroupUserRole
from
.tag
import
AccountUserTag
class
User
(
models
.
Model
):
class
Meta
:
verbose_name
=
u'用户'
verbose_name_plural
=
u'用户'
db_table
=
'account_user'
app_label
=
'api'
id
=
models
.
IntegerField
(
verbose_name
=
"主键ID"
,
primary_key
=
True
)
user_id
=
models
.
BigIntegerField
(
verbose_name
=
u'用户id'
,
unique
=
True
)
...
...
@@ -85,3 +83,15 @@ class User(models.Model):
return
same_group_detail_list
def
get_user_tag_id_list
(
self
):
try
:
user_tag_id_list
=
list
()
query_results
=
AccountUserTag
.
objects
.
get
(
user_id
=
self
.
user_id
)
for
item
in
query_results
:
user_tag_id_list
.
append
(
item
.
tag_id
)
return
user_tag_id_list
except
:
logging
.
error
(
"catch exception,err_msg:
%
s"
%
traceback
.
format_exc
())
return
None
\ No newline at end of file
trans2es/models/user_follow.py
View file @
09ad4446
...
...
@@ -13,9 +13,7 @@ from .user import User
class
UserFollow
(
models
.
Model
):
class
Meta
:
verbose_name
=
u'用户关注'
verbose_name_plural
=
u'用户关注'
db_table
=
'user_follow'
app_label
=
'api'
user
=
models
.
ForeignKey
(
User
,
related_name
=
'userfollow'
,
to_field
=
"user_id"
,
on_delete
=
models
.
CASCADE
)
follow_id
=
models
.
IntegerField
(
verbose_name
=
"关注的用户ID"
)
...
...
trans2es/utils/topic_transfer.py
View file @
09ad4446
...
...
@@ -25,6 +25,7 @@ class TopicTransfer(object):
res
[
"share_num"
]
=
instance
.
share_num
res
[
"pick_id_list"
]
=
instance
.
get_pick_id_info
()
res
[
"tag_list"
]
=
instance
.
get_topic_tag_id_list
()
create_time
=
instance
.
create_time
res
[
"create_time"
]
=
tzlc
(
create_time
)
...
...
trans2es/utils/user_transfer.py
View file @
09ad4446
...
...
@@ -24,7 +24,7 @@ class UserTransfer(object):
res
[
"create_time"
]
=
tzlc
(
instance
.
create_time
)
res
[
"update_time"
]
=
tzlc
(
instance
.
update_time
)
res
[
"tag_list"
]
=
""
res
[
"tag_list"
]
=
instance
.
get_user_tag_id_list
()
res
[
"attention_user_id_list"
]
=
instance
.
get_follow_user_id_list
()
res
[
"pick_user_id_list"
]
=
instance
.
get_pick_user_id_list
()
res
[
"same_group_user_id_list"
]
=
instance
.
get_same_group_user_id_list
()
...
...
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