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
fac61448
Commit
fac61448
authored
Apr 10, 2020
by
李小芳
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'kyc3' into 'master'
新标签 See merge request
!47
parents
c39194f3
90ff242b
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
70 additions
and
34 deletions
+70
-34
auto_comment.py
comment/views/auto_comment.py
+2
-1
comment_fun.py
comment/views/comment_fun.py
+2
-1
irrigation.py
moment/views/irrigation.py
+8
-4
process_time.py
moment/views/process_time.py
+58
-28
No files found.
comment/views/auto_comment.py
View file @
fac61448
...
...
@@ -50,6 +50,7 @@ def auto_comment_user(card_info, after_day=False):
content_level
=
card_info
[
"content_level"
]
card_info
[
"action_type"
]
=
"comment"
tag_names
=
card_info
[
'tag_names'
]
tagv3_names
=
card_info
[
'tagv3_names'
]
# 当满足这些条件的时候 代表已经完成了下发的所有的时间或者还没有下发过时间 需要给予新的时间
if
(
"all_follow_id"
in
card_info
and
"all_push_time"
in
card_info
and
len
(
...
...
@@ -71,7 +72,7 @@ def auto_comment_user(card_info, after_day=False):
if
len
(
get_time
)
>
0
and
time_region
!=
3
:
###拿到下发时间后根据下发的时间个数去拿对应个数的马甲账号
all_content
=
get_vest_userid_and_comment
(
need_comment_num
=
len
(
get_time
),
tag_names
=
tag_names
)
tag_names
=
tag_names
,
tagv3_names
=
tagv3_names
)
userids
=
get_vest_userid
(
need_comment_num
=
len
(
get_time
))
for
i
in
range
(
0
,
len
(
userids
)):
...
...
comment/views/comment_fun.py
View file @
fac61448
...
...
@@ -97,7 +97,8 @@ def comment(card_info):
###判断一下如果评论为空就重新拿一个
if
not
card_info
[
'comment_content'
]:
comment
=
get_vest_userid_and_comment
(
need_comment_num
=
1
,
tag_names
=
card_info
[
'tag_names'
])[
0
]
comment
=
get_vest_userid_and_comment
(
need_comment_num
=
1
,
tag_names
=
card_info
[
'tag_names'
],
tagv3_names
=
card_info
[
'tagv3_names'
])[
0
]
card_info
[
'comment_content'
]
=
comment
##在这里加一个判断 如果当前的评论的user_id和评论内容已经在这个评论下了就不再下发给同一个回答ID
...
...
moment/views/irrigation.py
View file @
fac61448
...
...
@@ -13,7 +13,8 @@ from libs.error import logging_exception
@bind
(
'vest/moment/vest_irrigation'
)
def
vest_irrigation
(
card_id
=
0
,
card_type
=
None
,
card_user_id
=
None
,
create_time
=
""
,
content_level
=
0
,
tag_names
=
[]):
def
vest_irrigation
(
card_id
=
0
,
card_type
=
None
,
card_user_id
=
None
,
create_time
=
""
,
content_level
=
0
,
tag_names
=
[],
tagv3_names
=
[]):
"""
在这里把后端传的数据存进卡夫卡 日记和帖子只需要发评论不需要点赞和关注
:param card_id:
...
...
@@ -47,7 +48,8 @@ def vest_irrigation(card_id=0, card_type=None, card_user_id=None, create_time=""
"tag_names"
:
tag_names
,
"type"
:
"get_write_answer_userinfo"
,
"current_push_time"
:
create_time
,
'action_type'
:
'comment'
'action_type'
:
'comment'
,
"tagv3_names"
:
tagv3_names
}
producer
.
send
(
topic
,
json
.
dumps
(
comment_msg_dict
)
.
encode
())
...
...
@@ -63,7 +65,8 @@ def vest_irrigation(card_id=0, card_type=None, card_user_id=None, create_time=""
"type"
:
"get_write_answer_userinfo"
,
"current_push_time"
:
create_time
,
'action_type'
:
'follow'
,
'card_user_id'
:
card_user_id
'card_user_id'
:
card_user_id
,
"tagv3_names"
:
tagv3_names
}
producer
.
send
(
topic
,
json
.
dumps
(
follow_msg_dict
)
.
encode
())
...
...
@@ -77,7 +80,8 @@ def vest_irrigation(card_id=0, card_type=None, card_user_id=None, create_time=""
"tag_names"
:
tag_names
,
"type"
:
"get_write_answer_userinfo"
,
"current_push_time"
:
create_time
,
'action_type'
:
'click'
'action_type'
:
'click'
,
"tagv3_names"
:
tagv3_names
}
producer
.
send
(
topic
,
json
.
dumps
(
click_msg_dict
)
.
encode
())
...
...
moment/views/process_time.py
View file @
fac61448
...
...
@@ -303,14 +303,69 @@ def get_vest_userid(need_comment_num=0):
return
12345
def
get_vest_userid_and_comment
(
need_comment_num
=
0
,
tag_names
=
[]):
def
get_vest_userid_and_comment
(
need_comment_num
=
0
,
tag_names
=
[]
,
tagv3_names
=
[]
):
try
:
content
=
[]
if
tagv3_names
:
content
=
by_tagv3_get_comment
(
need_comment_num
=
need_comment_num
,
tagv3_names
=
tagv3_names
)
else
:
if
need_comment_num
:
all_comment_list
=
[]
content
=
[]
redis_key
=
"vest_kyc_tag_content_data"
group_keys
=
"get_group_comment_by_tag:group_id"
for
item
in
tag_names
:
##如果自带的标签有kyc的话走kyc的标签
service_closure_tags
=
redis_client
.
hget
(
redis_key
,
str
(
item
))
if
service_closure_tags
:
closure_tags
=
json
.
loads
(
str
(
service_closure_tags
,
encoding
=
"utf-8"
))
all_comment_list
.
extend
(
closure_tags
)
if
all_comment_list
:
content
=
random
.
sample
(
all_comment_list
,
need_comment_num
)
else
:
##没有kyc的标签看标签所属的小组 拿对应小组的数据
all_group_ids
=
set
()
all_comments
=
[]
for
item
in
tag_names
:
sql_get_tagid
=
"select id from api_tag WHERE name = '
%
s'"
%
(
item
)
zhengxing_cursor
.
execute
(
sql_get_tagid
)
data
=
zhengxing_cursor
.
fetchall
()
if
len
(
data
):
tag_ids
=
data
[
0
]
# ids = data[0][0]
sql
=
'select tag_category_id from api_tag_category_relation where tag_id =
%
s'
%
(
tag_ids
)
zhengxing_cursor
.
execute
(
sql
)
group_ids
=
zhengxing_cursor
.
fetchall
()
for
item
in
group_ids
:
all_group_ids
.
add
(
item
[
0
])
for
all_group_id
in
list
(
all_group_ids
):
get_comment
=
redis_client
.
hget
(
group_keys
,
int
(
all_group_id
))
if
get_comment
:
comment
=
json
.
loads
(
str
(
get_comment
,
encoding
=
"utf-8"
))
all_comment_list
.
extend
(
comment
)
content
=
random
.
sample
(
all_comment_list
,
need_comment_num
)
zhengxing_cursor
.
close
()
return
content
except
:
logging
.
error
(
"catch exception,err_msg:
%
s"
%
traceback
.
format_exc
())
return
[]
def
by_tagv3_get_comment
(
need_comment_num
=
0
,
tagv3_names
=
[]):
try
:
content
=
[]
if
need_comment_num
:
all_comment_list
=
[]
content
=
[]
redis_key
=
"vest_kyc_tag_content_data"
redis_key
=
"vest_kyc_tag_content_data
_tagv3
"
group_keys
=
"get_group_comment_by_tag:group_id"
for
item
in
tag_names
:
for
item
in
tag
v3
_names
:
##如果自带的标签有kyc的话走kyc的标签
service_closure_tags
=
redis_client
.
hget
(
redis_key
,
str
(
item
))
if
service_closure_tags
:
...
...
@@ -319,31 +374,6 @@ def get_vest_userid_and_comment(need_comment_num=0, tag_names=[]):
if
all_comment_list
:
content
=
random
.
sample
(
all_comment_list
,
need_comment_num
)
else
:
##没有kyc的标签看标签所属的小组 拿对应小组的数据
all_group_ids
=
set
()
all_comments
=
[]
for
item
in
tag_names
:
sql_get_tagid
=
"select id from api_tag WHERE name = '
%
s'"
%
(
item
)
zhengxing_cursor
.
execute
(
sql_get_tagid
)
data
=
zhengxing_cursor
.
fetchall
()
if
len
(
data
):
tag_ids
=
data
[
0
]
# ids = data[0][0]
sql
=
'select tag_category_id from api_tag_category_relation where tag_id =
%
s'
%
(
tag_ids
)
zhengxing_cursor
.
execute
(
sql
)
group_ids
=
zhengxing_cursor
.
fetchall
()
for
item
in
group_ids
:
all_group_ids
.
add
(
item
[
0
])
for
all_group_id
in
list
(
all_group_ids
):
get_comment
=
redis_client
.
hget
(
group_keys
,
int
(
all_group_id
))
if
get_comment
:
comment
=
json
.
loads
(
str
(
get_comment
,
encoding
=
"utf-8"
))
all_comment_list
.
extend
(
comment
)
content
=
random
.
sample
(
all_comment_list
,
need_comment_num
)
zhengxing_cursor
.
close
()
return
content
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