Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
V
vest
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
2
Merge Requests
2
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
vest
Commits
34e31a72
Commit
34e31a72
authored
Jan 02, 2020
by
lixiaofang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
判断等级
parent
d36963cf
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
1 deletion
+36
-1
auto_comment.py
comment/views/auto_comment.py
+1
-0
process_time.py
moment/views/process_time.py
+35
-1
No files found.
comment/views/auto_comment.py
View file @
34e31a72
...
...
@@ -62,6 +62,7 @@ def auto_comment_user(card_info, after_day=False):
if
card_info
[
'type'
]
==
"get_write_answer_userinfo"
:
repeat_time
=
0
card_info
[
'have_comment_number'
]
=
0
get_time
,
time_region
=
get_content_time_by_create_time
(
create_time
,
content_level
,
action_type
=
"comment"
,
after_day
=
after_day
,
...
...
moment/views/process_time.py
View file @
34e31a72
...
...
@@ -17,6 +17,12 @@ from bs4 import BeautifulSoup
logger
=
logging
.
getLogger
(
__name__
)
producer
=
KafkaProducer
(
bootstrap_servers
=
settings
.
KAFKA_BROKER_LIST
)
db_zhengxing_eagle
=
pymysql
.
connect
(
host
=
settings
.
HOST
,
port
=
settings
.
PORT
,
user
=
settings
.
USER
,
password
=
settings
.
PASSWORD
,
db
=
settings
.
NAME
)
zhengxing_cursor
=
db_zhengxing_eagle
.
cursor
()
def
strTimeProp
(
start
,
end
,
prop
,
frmt
):
stime
=
time
.
mktime
(
time
.
strptime
(
start
,
frmt
))
...
...
@@ -147,7 +153,9 @@ def get_ten_last_days_random_time(num_days=None, frmt='%Y-%m-%d %H:%M:%S', conte
def
get_content_time_by_create_time
(
create_time
=
""
,
content_level
=
0
,
action_type
=
None
,
after_day
=
False
,
card_info
=
None
,
repeat_time
=
0
):
try
:
###在这个地方需要重新判断一下星级
# content_level = get_current_card_content_level(card_info)
##
card_info
[
'type'
]
=
'have_get_push_time'
card_info
[
'have_comment_number'
]
=
0
now
=
datetime
.
datetime
.
now
()
...
...
@@ -333,3 +341,29 @@ def judge_offset_partition_have_consum(offset=0, partition=0):
except
:
logging
.
error
(
"catch exception,err_msg:
%
s"
%
traceback
.
format_exc
())
return
False
def
get_current_card_content_level
(
card_info
=
[]):
try
:
# 先根据card_id回去内容提取关键字
sql
=
'select content from api_answer where id =
%
s '
%
(
card_info
[
'card_id'
])
# zhengxing_cursor.execute(sql)
# data = list(zhengxing_cursor.fetchall())
# logging.info("get data:%s" % data)
# zhengxing_cursor.close()
# if len(data) > 0:
# soup = BeautifulSoup(data[0][0], 'html.parser')
# contents = soup.text
#
# ck = GetContentKeyWords()
# keywords = ck.get_keywords(contents, len(ck.tag_list))
# if keywords:
# tag_names.append(keywords)
#
# return tag_names
except
:
logging
.
error
(
"catch exception,err_msg:
%
s"
%
traceback
.
format_exc
())
return
[]
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