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
0b931191
Commit
0b931191
authored
Jan 14, 2020
by
李小芳
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'change_time' into 'master'
add See merge request
!28
parents
3e368411
5d0b6d55
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
9 deletions
+7
-9
consum.py
moment/views/consum.py
+7
-6
irrigation.py
moment/views/irrigation.py
+0
-3
No files found.
moment/views/consum.py
View file @
0b931191
...
...
@@ -54,8 +54,9 @@ def kafka_consum(topic_name=None):
# bol_consum = judge_data_have_in_redis(card_info)
bol_consum
=
True
if
bol_consum
:
logging
.
info
(
"消费到新数据了[
%
s,
%
s,
%
s,
%
s],get card_info:
%
s"
%
(
str
(
msg
.
topic
),
str
(
msg
.
partition
),
str
(
msg
.
offset
),
str
(
msg
.
key
),
card_info
))
logging
.
info
(
"消费到新数据了[
%
s,
%
s,
%
s,
%
s],get card_id:
%
s,create_time:
%
s,current_push_time:
%
s"
%
(
str
(
msg
.
topic
),
str
(
msg
.
partition
),
str
(
msg
.
offset
),
str
(
msg
.
key
),
card_info
[
"card_id"
],
card_info
[
'create_time'
],
card_info
[
'current_push_time'
]))
# 如果没有代表是之前的老的数据
if
'card_status'
not
in
card_info
:
card_info
[
'card_status'
]
=
'answer'
...
...
@@ -99,7 +100,7 @@ def kafka_consum(topic_name=None):
card_info
[
'have_comment_number'
]
<
20
:
card_info
[
"have_comment_number"
]
+=
1
is_success
=
comment
(
card_info
)
logging
.
info
(
"comment [
%
s,
%
s,
%
s,
%
s],当前ID:
%
s,
下发状
状态:
%
s"
%
(
logging
.
info
(
"comment [
%
s,
%
s,
%
s,
%
s],当前ID:
%
s,状态:
%
s"
%
(
str
(
msg
.
topic
),
str
(
msg
.
partition
),
str
(
msg
.
offset
),
str
(
msg
.
key
),
card_info
[
"card_id"
],
is_success
))
...
...
@@ -113,7 +114,7 @@ def kafka_consum(topic_name=None):
if
'have_click_number'
in
card_info
:
card_info
[
"have_click_number"
]
+=
1
is_success
=
click
(
card_info
)
logging
.
info
(
"click [
%
s,
%
s,
%
s,
%
s],当前ID:
%
s,
下发状
状态:
%
s"
%
(
logging
.
info
(
"click [
%
s,
%
s,
%
s,
%
s],当前ID:
%
s,状态:
%
s"
%
(
str
(
msg
.
topic
),
str
(
msg
.
partition
),
str
(
msg
.
offset
),
str
(
msg
.
key
),
card_info
[
"card_id"
],
is_success
))
...
...
@@ -126,7 +127,7 @@ def kafka_consum(topic_name=None):
if
'have_follow_number'
in
card_info
:
card_info
[
"have_follow_number"
]
+=
1
is_success
=
follow
(
card_info
)
logging
.
info
(
"follow [
%
s,
%
s,
%
s,
%
s],当前ID:
%
s,
下发状
状态:
%
s"
%
(
logging
.
info
(
"follow [
%
s,
%
s,
%
s,
%
s],当前ID:
%
s,状态:
%
s"
%
(
str
(
msg
.
topic
),
str
(
msg
.
partition
),
str
(
msg
.
offset
),
str
(
msg
.
key
),
card_info
[
"card_id"
],
is_success
))
...
...
@@ -136,7 +137,7 @@ def kafka_consum(topic_name=None):
pass
else
:
# push_time时间未到 需要等待
logging
.
info
(
"follow [
%
s,
%
s,
%
s,
%
s],
push_time未到,需要
等待"
%
(
logging
.
info
(
"follow [
%
s,
%
s,
%
s,
%
s],等待"
%
(
str
(
msg
.
topic
),
str
(
msg
.
partition
),
str
(
msg
.
offset
),
str
(
msg
.
key
)))
save_data_to_kafka
(
card_info
)
else
:
...
...
moment/views/irrigation.py
View file @
0b931191
...
...
@@ -27,8 +27,6 @@ def vest_irrigation(card_id=0, card_type=None, card_user_id=None, create_time=""
try
:
producer
=
KafkaProducer
(
bootstrap_servers
=
settings
.
KAFKA_BROKER_LIST
)
logging
.
info
(
"新数据进来了:
%
s"
%
card_id
)
topic
=
settings
.
KAFKA_TOPIC_NAME
tag_list
=
[
"瘦脸针kyc"
,
"双眼皮kyc"
,
"水光针kyc"
,
"玻尿酸kyc"
,
"吸脂kyc"
,
"祛痘kyc"
,
"鼻综合kyc"
,
"光子嫩肤kyc"
,
"没有想法kyc"
,
"牙齿kyc"
,
"抗衰紧致kyc"
,
"胸部kyc"
,
"果酸换肤kyc"
,
"祛斑kyc"
,
"美白针kyc"
,
"瘦腿针kyc"
]
...
...
@@ -51,7 +49,6 @@ def vest_irrigation(card_id=0, card_type=None, card_user_id=None, create_time=""
'action_type'
:
'comment'
}
logging
.
info
(
"get comment_msg_dict:
%
s"
%
comment_msg_dict
)
producer
.
send
(
topic
,
json
.
dumps
(
comment_msg_dict
)
.
encode
())
if
card_type
==
'answer'
:
...
...
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