Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
F
ffm-baseline
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ML
ffm-baseline
Commits
ffc94efc
Commit
ffc94efc
authored
Mar 04, 2020
by
赵威
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add tag3 update user portrait
parent
25060603
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
2 deletions
+35
-2
tag3_update_user_portrait_offline.py
eda/smart_rank/tag3_update_user_portrait_offline.py
+5
-0
tool.py
eda/smart_rank/tool.py
+30
-2
No files found.
eda/smart_rank/tag3_update_user_portrait_offline.py
0 → 100644
View file @
ffc94efc
from
tool
import
get_tag3_user_log
if
__name__
==
"__main__"
:
log
=
get_tag3_user_log
(
"866017030837899"
)
print
(
log
)
eda/smart_rank/tool.py
View file @
ffc94efc
...
...
@@ -36,8 +36,8 @@ def send_email(app,id,e):
try
:
with
open
(
'error.txt'
,
'w'
)
as
f
:
f
.
write
(
e
)
f
.
close
()
f
.
write
(
e
)
f
.
close
()
part
=
MIMEApplication
(
open
(
'error.txt'
,
'r'
)
.
read
())
part
.
add_header
(
'Content-Disposition'
,
'attachment'
,
filename
=
"error.txt"
)
msg
.
attach
(
part
)
...
...
@@ -353,3 +353,31 @@ def get_user_log(cl_id, all_word_tags, pay_time=0, debug=0):
return
user_df_service
def
get_jerry_test_cursor
():
db
=
pymysql
.
connect
(
host
=
"172.16.40.158"
,
port
=
4000
,
user
=
"st_user"
,
passwd
=
"aqpuBLYzEV7tML5RPsN1pntUzFy"
,
db
=
"jerry_test"
,
charset
=
"utf8"
)
return
db
.
cursor
()
def
get_tag3_user_log
(
cl_id
):
columns
=
[
"log_time"
,
"cl_id"
,
"tag_referrer"
,
"score_type"
,
"action"
,
"event"
,
"event_cn"
,
"first_solutions"
,
"second_solutions"
,
"first_demands"
,
"second_demands"
,
"first_positions"
,
"second_positions"
,
"projects"
,
"card_type"
]
sql
=
"""select log_time, cl_id, tag_referrer, score_type, action, event, event_cn, first_solutions,
second_solutions, first_demands, second_demands, first_positions, second_positions,
projects, card_type from kafka_tag3_log where cl_id = '{}'"""
.
format
(
cl_id
)
cursor
=
get_jerry_test_cursor
()
cursor
.
execute
(
sql
)
data
=
list
(
cursor
.
fetchall
())
if
data
:
user_df
=
pd
.
DataFrame
(
data
)
user_df
.
columns
=
columns
else
:
return
pd
.
DataFrame
(
columns
=
columns
)
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