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
b5a23082
Commit
b5a23082
authored
Sep 27, 2019
by
高雅喆
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
es pictorial update
parent
82c67b7b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
0 deletions
+27
-0
portrait_stat.py
trans2es/models/portrait_stat.py
+25
-0
pictorial_transfer.py
trans2es/utils/pictorial_transfer.py
+2
-0
No files found.
trans2es/models/portrait_stat.py
View file @
b5a23082
...
...
@@ -46,6 +46,9 @@ class LikePictorialStat(models.Model):
is_new_pictorial
=
models
.
IntegerField
(
verbose_name
=
u"是否是新问题"
)
pictorial_ctr_30
=
models
.
FloatField
(
verbose_name
=
u"30天内问题的ctr"
)
like_rate_30
=
models
.
FloatField
(
verbose_name
=
u"30天内问题的点赞率"
)
pictorial_ctr_all
=
models
.
FloatField
(
verbose_name
=
u"历史该问题的ctr"
)
like_rate_all
=
models
.
FloatField
(
verbose_name
=
u"历史该问题的点赞率"
)
@classmethod
def
get_pictorial_is_new
(
cls
,
pictorial_id
):
...
...
@@ -79,3 +82,25 @@ class LikePictorialStat(models.Model):
except
:
logging
.
error
(
"catch exception,err_msg:
%
s"
%
traceback
.
format_exc
())
return
0.0
@classmethod
def
get_pictorial_ctr_all
(
cls
,
pictorial_id
):
try
:
pictorial_ctr_all
=
LikePictorialStat
.
objects
.
using
(
settings
.
SLAVE1_DB_NAME
)
.
filter
(
pictorial_id
=
pictorial_id
)
.
values_list
(
"pictorial_ctr_all"
,
flat
=
True
)
.
first
()
return
pictorial_ctr_all
except
:
logging
.
error
(
"catch exception,err_msg:
%
s"
%
traceback
.
format_exc
())
return
0.0
@classmethod
def
get_pictorial_like_rate_all
(
cls
,
pictorial_id
):
try
:
like_rate_all
=
LikePictorialStat
.
objects
.
using
(
settings
.
SLAVE1_DB_NAME
)
.
filter
(
pictorial_id
=
pictorial_id
)
.
values_list
(
"like_rate_all"
,
flat
=
True
)
.
first
()
return
like_rate_all
except
:
logging
.
error
(
"catch exception,err_msg:
%
s"
%
traceback
.
format_exc
())
return
0.0
trans2es/utils/pictorial_transfer.py
View file @
b5a23082
...
...
@@ -79,6 +79,8 @@ class PictorialTransfer(object):
res
[
"is_new_pictorial"
]
=
LikePictorialStat
.
get_pictorial_is_new
(
instance
.
id
)
res
[
"pictorial_ctr_30"
]
=
LikePictorialStat
.
get_pictorial_ctr_30
(
instance
.
id
)
res
[
"like_rate_30"
]
=
LikePictorialStat
.
get_pictorial_like_rate_30
(
instance
.
id
)
res
[
"pictorial_ctr_all"
]
=
LikePictorialStat
.
get_pictorial_ctr_all
(
instance
.
id
)
res
[
"like_rate_all"
]
=
LikePictorialStat
.
get_pictorial_like_rate_all
(
instance
.
id
)
logging
.
info
(
"get data:
%
s"
%
res
)
return
res
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