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
bf1eb45b
Commit
bf1eb45b
authored
Jan 08, 2021
by
李小芳
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
smr
parent
70f3fb71
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
43 additions
and
4 deletions
+43
-4
transfer.py
data_sync/answer/transfer.py
+3
-1
transfer.py
data_sync/tractate/transfer.py
+4
-1
answer.py
qa/models/answer.py
+17
-0
tractate.py
talos/models/tractate/tractate.py
+19
-2
No files found.
data_sync/answer/transfer.py
View file @
bf1eb45b
...
...
@@ -200,8 +200,10 @@ def get_answers(pks):
projects
=
[
list
(
item
.
keys
())[
0
]
for
item
in
result_data
.
get
(
"projects"
,
[])]
item
[
'portrait_tag_name'
]
.
extend
(
projects
)
data
.
append
(
item
)
if
3315
in
item
[
'operators_add_tags'
]:
item
[
'new_smr'
]
=
answer
.
get_answer_newuser_smr
(
answer_id
=
answer
.
id
)
data
.
append
(
item
)
except
(
Answer
.
DoesNotExist
,
Question
.
DoesNotExist
):
pass
...
...
data_sync/tractate/transfer.py
View file @
bf1eb45b
...
...
@@ -232,13 +232,16 @@ def get_tractate(pks):
get_names
=
True
)
# 首页精选增加内容分类和明星列表和网红列表
result_data
=
alo_model
.
run
(
tractate
.
content
)
result_data
=
alo_model
.
run
(
tractate
.
content
)
item
[
'selected_content_type'
]
=
int
(
result_data
.
get
(
"content_type"
,
0
))
item
[
'selected_internet_celebrity'
]
=
[
list
(
item
.
keys
())[
0
]
for
item
in
result_data
.
get
(
"celebrity"
,
[])]
item
[
'selected_stars'
]
=
[
list
(
item
.
keys
())[
0
]
for
item
in
result_data
.
get
(
"star"
,
[])]
projects
=
[
list
(
item
.
keys
())[
0
]
for
item
in
result_data
.
get
(
"projects"
,
[])]
item
[
'portrait_tag_name'
]
.
extend
(
projects
)
if
3315
in
item
[
'operators_add_tags'
]:
item
[
'new_smr'
]
=
tractate
.
get_tractate_newuser_smr
(
tractate_id
=
tractate
.
id
)
data
.
append
(
item
)
logging
.
info
(
"get data:
%
s"
%
data
)
return
data
...
...
qa/models/answer.py
View file @
bf1eb45b
...
...
@@ -1013,6 +1013,14 @@ class Answer(models.Model):
logging
.
error
(
"catch exception,err_msg:
%
s"
%
traceback
.
format_exc
())
return
0
def
get_answer_newuser_smr
(
self
,
answer_id
):
score
=
SrategyAnswerSmrScore
.
objects
.
using
(
settings
.
DORIS_DB_NAME
)
.
filter
(
answer_id
=
answer_id
)
.
order_by
(
'-create_date'
)
.
values_list
(
"smart_rank_score"
,
flat
=
True
)
.
first
()
if
score
:
return
score
else
:
return
0
def
get_search_new_smart_rank_score
(
self
,
answer_id
):
try
:
today
=
datetime
.
datetime
.
now
()
.
date
()
...
...
@@ -1677,6 +1685,15 @@ class StrategyAnswerSmrScore(models.Model):
create_date
=
models
.
BigIntegerField
(
max_length
=
50
,
verbose_name
=
"时间"
)
class
SrategyAnswerSmrScore
(
models
.
Model
):
class
Meta
:
db_table
=
'strategy_answer_smr_score'
answer_id
=
models
.
IntegerField
(
unique
=
True
)
smart_rank_score
=
models
.
FloatField
(
verbose_name
=
u'新的smr_score'
,
blank
=
True
,
default
=
0
)
create_date
=
models
.
BigIntegerField
(
max_length
=
50
,
verbose_name
=
"时间"
)
class
SearchStrategyAnswerSmrScore
(
models
.
Model
):
class
Meta
:
db_table
=
'search_strategy_answer_new_smart_rank_score'
...
...
talos/models/tractate/tractate.py
View file @
bf1eb45b
...
...
@@ -482,8 +482,7 @@ class Tractate(models.Model):
n_days
=
today
-
delta
date_change
=
str
(
n_days
)
.
replace
(
"-"
,
""
)
score
=
StrategyTractateSmrScoreV2
.
objects
.
using
(
settings
.
DORIS_DB_NAME
)
.
filter
(
tractate_id
=
tractate_id
)
.
order_by
(
'-create_date'
)
.
values_list
(
"smart_rank_score"
,
flat
=
True
)
.
first
()
tractate_id
=
tractate_id
)
.
order_by
(
'-create_date'
)
.
values_list
(
"smart_rank_score"
,
flat
=
True
)
.
first
()
if
score
:
return
score
else
:
...
...
@@ -492,6 +491,14 @@ class Tractate(models.Model):
logging
.
error
(
"catch exception,err_msg:
%
s"
%
traceback
.
format_exc
())
return
0
def
get_tratate_newuser_smr
(
self
,
tractate_id
):
score
=
SrategyTractateSmrScore
.
objects
.
using
(
settings
.
DORIS_DB_NAME
)
.
filter
(
tractate_id
=
tractate_id
)
.
order_by
(
'-create_date'
)
.
values_list
(
"smart_rank_score"
,
flat
=
True
)
.
first
()
if
score
:
return
score
else
:
return
0
def
get_search_tractate_new_smart_rank_score
(
self
,
tractate_id
):
try
:
today
=
datetime
.
datetime
.
now
()
.
date
()
...
...
@@ -716,6 +723,7 @@ class StrategyTractateSmrScore(models.Model):
smart_rank_score
=
models
.
FloatField
(
verbose_name
=
u'新的smr_score'
,
blank
=
True
,
default
=
0
)
create_date
=
models
.
BigIntegerField
(
max_length
=
50
,
verbose_name
=
"时间"
)
class
StrategyTractateSmrScoreV2
(
models
.
Model
):
class
Meta
:
db_table
=
'search_strategy_tractate_new_smart_rank_score_v2'
...
...
@@ -725,6 +733,15 @@ class StrategyTractateSmrScoreV2(models.Model):
create_date
=
models
.
BigIntegerField
(
max_length
=
50
,
verbose_name
=
"时间"
)
class
SrategyTractateSmrScore
(
models
.
Model
):
class
Meta
:
db_table
=
'strategy_tractate_smr_score'
tractate_id
=
models
.
IntegerField
(
unique
=
True
)
smart_rank_score
=
models
.
FloatField
(
verbose_name
=
u'新的smr_score'
,
blank
=
True
,
default
=
0
)
create_date
=
models
.
BigIntegerField
(
max_length
=
50
,
verbose_name
=
"时间"
)
class
SearchStrategyTractateSmrScore
(
models
.
Model
):
class
Meta
:
db_table
=
'search_strategy_tractate_new_smart_rank_score'
...
...
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