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
8898520a
Commit
8898520a
authored
Jan 06, 2020
by
lixiaofang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
暂时去掉需要判断offset的接口
parent
3312eab5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
76 additions
and
20 deletions
+76
-20
auto_comment.py
comment/views/auto_comment.py
+1
-3
comment_fun.py
comment/views/comment_fun.py
+1
-1
irrigation.py
moment/views/irrigation.py
+9
-9
process_time.py
moment/views/process_time.py
+62
-4
settings_local.py
vest/settings_local.py
+3
-3
No files found.
comment/views/auto_comment.py
View file @
8898520a
...
...
@@ -49,7 +49,6 @@ def auto_comment_user(card_info, after_day=False):
create_time
=
card_info
[
"create_time"
]
content_level
=
card_info
[
"content_level"
]
card_info
[
"action_type"
]
=
"comment"
tag_names
=
card_info
[
'tag_names'
]
# 当满足这些条件的时候 代表已经完成了下发的所有的时间或者还没有下发过时间 需要给予新的时间
if
(
"all_follow_id"
in
card_info
and
"all_push_time"
in
card_info
and
len
(
...
...
@@ -71,8 +70,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
,
card_id
=
card_info
[
'card_id'
])
card_info
=
card_info
)
userids
=
get_vest_userid
(
need_comment_num
=
len
(
get_time
))
for
i
in
range
(
0
,
len
(
userids
)):
...
...
comment/views/comment_fun.py
View file @
8898520a
...
...
@@ -115,7 +115,7 @@ def comment(card_info):
comment_num
=
redis_data
[
"comment"
]
###判断一下如果评论为空就重新拿一个
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
,
card_info
=
card_info
)[
0
]
card_info
[
'comment_content'
]
=
comment
if
comment_num
>
12
:
...
...
moment/views/irrigation.py
View file @
8898520a
...
...
@@ -30,22 +30,22 @@ def vest_irrigation(card_id=0, card_type=None, card_user_id=None, create_time=""
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"
]
flag
=
False
if
len
(
tag_names
)
>
0
:
for
i
in
tag_names
:
if
i
in
tag_list
:
flag
=
True
#
tag_list = ["瘦脸针kyc", "双眼皮kyc", "水光针kyc", "玻尿酸kyc", "吸脂kyc", "祛痘kyc", "鼻综合kyc", "光子嫩肤kyc", "没有想法kyc",
#
"牙齿kyc", "抗衰紧致kyc", "胸部kyc", "果酸换肤kyc", "祛斑kyc", "美白针kyc", "瘦腿针kyc"]
#
flag = False
#
if len(tag_names) > 0:
#
for i in tag_names:
#
if i in tag_list:
#
flag = True
if
flag
==
True
:
if
tag_names
:
comment_msg_dict
=
{
"card_id"
:
card_id
,
"card_type"
:
"auto_vest"
,
'card_status'
:
card_type
,
"create_time"
:
create_time
,
"content_level"
:
content_level
,
"
c
"
:
tag_names
,
"
tag_names
"
:
tag_names
,
"type"
:
"get_write_answer_userinfo"
,
"current_push_time"
:
create_time
,
'action_type'
:
'comment'
...
...
moment/views/process_time.py
View file @
8898520a
...
...
@@ -159,7 +159,8 @@ 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
[
'content_level'
]
=
content_level
##
...
...
@@ -210,6 +211,7 @@ def get_click_follow_time_by_create_time(create_time="", content_level=0, action
try
:
######在这个地方需要重新判断一下星级
content_level
=
get_current_card_content_level
(
card_info
)
card_info
[
'content_level'
]
=
content_level
####
card_info
[
'have_click_number'
]
=
0
...
...
@@ -280,7 +282,14 @@ def get_vest_userid(need_comment_num=0):
return
12345
def
get_vest_userid_and_comment
(
need_comment_num
=
0
,
tag_names
=
[],
card_id
=
0
):
def
get_vest_userid_and_comment
(
need_comment_num
=
0
,
card_info
=
[]):
"""
需要判断当前的标签是否含有kyc标签,如果没有的话,就看普通的项目标签的组是否有评论池,去拿评论池的东西
:param need_comment_num:
:param tag_names:
:param card_id:
:return:
"""
try
:
##先根据card_id回去内容提取关键字
...
...
@@ -304,15 +313,28 @@ def get_vest_userid_and_comment(need_comment_num=0, tag_names=[], card_id=0):
# keywords = ck.get_keywords(contents, len(ck.tag_list))
# if keywords:
# tag_names.append(keywords)
nokyc_tag_names
=
[]
kyc_tag_names
=
[]
content
=
[]
nokyc_tag_ids
=
[]
for
tag
in
card_info
[
'tag_names'
]:
item
=
tag
.
get
(
"tag_name"
,
None
)
if
'kyc'
in
item
:
kyc_tag_names
.
append
(
item
)
else
:
nokyc_tag_names
.
append
(
item
)
nokyc_tag_ids
.
append
(
tag
.
get
(
'id'
,
None
))
if
need_comment_num
:
##如果有kyc只拿kyc的标签评论
if
kyc_tag_names
and
need_comment_num
:
all_comment_list
=
[]
redis_key
=
"vest_kyc_tag_content_data"
all_keys
=
redis_client
.
hkeys
(
redis_key
)
all_keys_name
=
[]
for
item
in
all_keys
:
all_keys_name
.
append
(
str
(
item
,
encoding
=
"utf-8"
))
for
item
in
tag_names
:
for
item
in
kyc_
tag_names
:
if
item
in
all_keys_name
:
service_closure_tags
=
redis_client
.
hget
(
redis_key
,
item
)
closure_tags
=
json
.
loads
(
str
(
service_closure_tags
,
encoding
=
"utf-8"
))
...
...
@@ -322,8 +344,44 @@ def get_vest_userid_and_comment(need_comment_num=0, tag_names=[], card_id=0):
else
:
content
=
[]
##如果没有就只拿标签组的评论
elif
nokyc_tag_names
and
need_comment_num
:
all_group_ids
=
set
()
all_group_names
=
[]
format_strings
=
","
.
join
([
"
%
s"
]
*
len
(
nokyc_tag_ids
))
%
tuple
(
nokyc_tag_ids
)
sql
=
"select tag_category_id from api_tag_category_relation where tag_id in (
%
s)"
%
format_strings
zhengxing_cursor
.
execute
(
sql
)
data
=
list
(
zhengxing_cursor
.
fetchall
())
for
item
in
data
:
all_group_ids
.
add
(
item
[
0
])
group_format_strings
=
","
.
join
([
"
%
s"
]
*
len
(
all_group_ids
))
%
tuple
(
all_group_ids
)
sql
=
"select tag_category_id from api_tag_category_relation where tag_id in (
%
s)"
%
group_format_strings
zhengxing_cursor
.
execute
(
sql
)
data
=
list
(
zhengxing_cursor
.
fetchall
())
for
item
in
data
:
all_group_names
.
append
(
item
[
0
])
###评论池从redis中拿
all_comment_list
=
[]
redis_key
=
"vest_nokyc_group_tag_content_data"
all_keys
=
redis_client
.
hkeys
(
redis_key
)
all_keys_name
=
[]
for
item
in
all_keys
:
all_keys_name
.
append
(
str
(
item
,
encoding
=
"utf-8"
))
for
item
in
all_group_names
:
if
item
in
all_keys_name
:
service_closure_tags
=
redis_client
.
hget
(
redis_key
,
item
)
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
:
content
=
[]
else
:
content
=
[]
##都没有的话就不下发评论
return
content
except
:
...
...
vest/settings_local.py
View file @
8898520a
...
...
@@ -17,14 +17,14 @@ ENGINE = 'django.db.backends.mysql', # 设置为mysql数据库
NAME
=
'mimas_test'
USER
=
'work'
PASSWORD
=
'Gengmei1'
HOST
=
'bj-cdb-
6slgqwl
c.sql.tencentcdb.com'
PORT
=
621
20
HOST
=
'bj-cdb-
b8oeeja
c.sql.tencentcdb.com'
PORT
=
621
18
ENGINE1
=
'django.db.backends.mysql'
,
# 设置为mysql数据库
NAME1
=
'zhengxing_test'
USER1
=
'work'
PASSWORD1
=
'Gengmei1'
HOST1
=
'bj-cdb-
6slgqwl
c.sql.tencentcdb.com'
HOST1
=
'bj-cdb-
b8oeeja
c.sql.tencentcdb.com'
OPTIONS
=
{
"init_command"
:
"SET foreign_key_checks = 0;"
,
...
...
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