Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
M
mentha
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
1
Merge Requests
1
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
rank
mentha
Commits
28a43206
Commit
28a43206
authored
Nov 18, 2020
by
李小芳
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add
parent
df566a96
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
39 additions
and
6 deletions
+39
-6
transfer.py
data_sync/answer/transfer.py
+4
-2
transfer.py
data_sync/principal_page/transfer.py
+23
-0
transfer.py
data_sync/tractate/transfer.py
+5
-3
answer.py
qa/models/answer.py
+7
-1
No files found.
data_sync/answer/transfer.py
View file @
28a43206
...
...
@@ -48,8 +48,10 @@ def get_answers(pks):
tag_ids
=
[
t
.
tag_id
for
t
in
answer
.
question
.
tags
]
item
[
'tag_ids'
]
=
tag_ids
tags_id_list
=
[
t
.
tag_id
for
t
in
answer
.
question
.
tags
]
item
[
'tag_name'
]
=
QuestionTag
.
get_name_list
(
tags_id_list
)
item
[
'tag_name_analyze'
]
=
QuestionTag
.
get_name_list
(
tags_id_list
)
qt
=
QuestionTag
()
item
[
'tag_name'
]
=
qt
.
get_name_list
(
tags_id_list
)
item
[
'tag_name_analyze'
]
=
qt
.
get_name_list
(
tags_id_list
)
item
[
'portrait_tag_name'
]
=
qt
.
get_project_tags
(
tag_list
=
tag_ids
)
item
[
"hot_score"
]
=
answer
.
get_hot_score_answer
()
item
[
'new_smr'
]
=
answer
.
get_new_smart_rank_score
(
answer_id
=
answer
.
id
)
score
=
answer
.
get_search_new_smart_rank_score
(
answer_id
=
answer
.
id
)
...
...
data_sync/principal_page/transfer.py
View file @
28a43206
...
...
@@ -7,6 +7,7 @@ from talos.models.topic.activity import Activity
from
talos.models.soft_article
import
SoftArticle
from
talos.services.user
import
UserService
from
talos.services.doctor
import
DoctorService
from
talos.services.hospital
import
HospitalService
from
data_sync.utils
import
tzlc
from
talos.models.topic
import
Problem
...
...
@@ -51,6 +52,28 @@ def get_live_stream(pks):
item
[
'is_show'
]
=
live
.
is_show
item
[
'stick_status'
]
=
live
.
stick_status
item
[
'stick_timestamp'
]
=
live
.
stick_timestamp
us
=
UserService
()
hs
=
HospitalService
()
hospital_city_id
=
None
hospital_info
=
us
.
get_doctor_hospital_id_by_user_id
(
user_id
=
user_id
)
if
hospital_info
.
get
(
"hospital_id"
):
hospital_id
=
hospital_info
.
get
(
"hospital_id"
,
None
)
hospital_city_id
=
hs
.
get_hospital_from_hospital_ids
(
ids
=
[
hospital_id
])
if
hospital_city_id
:
for
hospital
in
hospital_city_id
:
hospital_city_id
=
hospital
.
city_tag_id
elif
hospital_info
.
get
(
"doctor_id"
):
doctor_id
=
hospital_info
.
get
(
"doctor_id"
,
None
)
hospital
=
hs
.
get_hospital_from_doctor_id
(
id
=
doctor_id
)
if
hospital
:
hospital_id
=
hospital
.
id
hospital_city_id
=
hs
.
get_hospital_from_hospital_ids
(
ids
=
[
hospital_id
])
if
hospital_city_id
:
for
hospital
in
hospital_city_id
:
hospital_city_id
=
hospital
.
city_tag_id
item
[
'allow_city'
]
=
live
.
allow_city
(
hospital_city_id
,
live
.
id
)
data
.
append
(
item
)
logging
.
info
(
"get data:
%
s"
%
data
)
...
...
data_sync/tractate/transfer.py
View file @
28a43206
...
...
@@ -7,7 +7,7 @@ from data_sync.utils import to_epoch, tzlc
from
qa.models.toutiao
import
by_content_type_id_get_keywords
,
get_content_star_keywords
,
get_content_title_keywords
,
\
get_content_star_first_keyword
,
has_service
from
talos.services.convert_service.user_convert_service
import
UserConvertService
from
gm_types.gaia
import
DOCTOR_TYPE
,
TAG_V3_TYPE
from
gm_types.gaia
import
DOCTOR_TYPE
,
TAG_V3_TYPE
,
TAG_TYPE
from
tags.services.tag
import
(
get_tagv3_analysis_info
,
get_tag_v3_operators_tags
,
get_tag_v3_anecdote_tags
,
get_tag_v3_anecdote_tag_ids
,
get_tag_v3_channel_tags_tags
,
get_tag_v3_names_by_tag_v3_ids
)
...
...
@@ -83,6 +83,9 @@ def get_tractate(pks):
item
[
"tractate_tag"
]
=
tractate
.
get_tag
(
tag_list
)
tractate_tag_name
=
tractate
.
get_tag_names
(
tag_list
)
item
[
"tractate_tag_name"
]
=
tractate_tag_name
item
[
'portrait_tag_name'
]
=
[
t
.
get
(
"tag_name"
,
None
)
for
t
in
item
[
"tractate_tag"
]
if
t
.
get
(
"tag_type"
,
0
)
in
(
TAG_TYPE
.
BODY_PART
,
TAG_TYPE
.
BODY_PART_SUB_ITEM
,
TAG_TYPE
.
ITEM_WIKI
)]
item
[
"is_video"
]
=
tractate
.
get_is_video
item
[
"tractate_tag_name_content"
]
=
tractate
.
get_tag_names_content
(
tag_list
)
item
[
"hot_score"
]
=
tractate
.
get_hot_score
()
...
...
@@ -102,8 +105,7 @@ def get_tractate(pks):
item
[
"content_star_keyword"
]
=
get_content_star_keywords
(
id
=
tractate
.
id
,
content_type
=
"usertopic"
)
item
[
"content_star_first_keyword"
]
=
get_content_star_first_keyword
(
id
=
tractate
.
id
,
content_type
=
"usertopic"
)
# item["has_service"] = has_service(tractate_tag_list, content_keyword)
item
[
"has_service"
]
=
False
item
[
"has_service"
]
=
has_service
(
tractate_tag_list
,
content_keyword
)
item
[
"user_type"
]
=
get_user_type
(
tractate
.
user_id
)
item
[
'has_picture'
]
=
tractate
.
get_tractate_image
...
...
qa/models/answer.py
View file @
28a43206
...
...
@@ -14,7 +14,7 @@ from django.utils import timezone
from
django.utils.html
import
escape
from
data_sync.utils
import
to_epoch
,
tzlc
from
gm_serializer
import
fields
from
gm_types.gaia
import
USER_TYPE
,
VOTEOBJECT
,
DIARY_CONTENT_LEVEL
from
gm_types.gaia
import
USER_TYPE
,
VOTEOBJECT
,
DIARY_CONTENT_LEVEL
,
TAG_TYPE
from
gm_types.mimas
import
(
SPAM_LABEL
,
GRABBING_PLATFORM
,
...
...
@@ -42,6 +42,7 @@ from utils.exceptions import Impossible
from
utils.common
import
convert_image
from
utils.user
import
get_user_gm_url
from
utils.protocol
import
gm_protocol
from
talos.services.tag
import
TagService
# from talos.models.tractate.tractate import StrategyContentExposureIndex
...
...
@@ -385,6 +386,11 @@ class QuestionTag(models.Model):
name
.
append
(
i
[
'name'
])
return
name
def
get_project_tags
(
self
,
tag_list
):
tag_list
=
TagService
.
_get_by_ids_from_cache_type
(
list
(
tag_list
))
return
[
t
.
name
for
t
in
tag_list
if
t
.
tag_type
in
(
TAG_TYPE
.
BODY_PART
,
TAG_TYPE
.
BODY_PART_SUB_ITEM
,
TAG_TYPE
.
ITEM_WIKI
)]
class
QuestionTagV3
(
models
.
Model
):
class
Meta
:
...
...
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