Commit ef9614a8 authored by lixiaofang's avatar lixiaofang

add

parent e9f485d8
...@@ -81,15 +81,22 @@ def get_pictorial_tag_by_id(pictorial_id): ...@@ -81,15 +81,22 @@ def get_pictorial_tag_by_id(pictorial_id):
def get_category_tag_id(edit_tag_list): def get_category_tag_id(edit_tag_list):
try: try:
logging.info("get -----------")
# 拿到搜索的分类 # 拿到搜索的分类
all_category_tag_list = CommunityCategoryTagRelation.objects.filter(tag_id__in=edit_tag_list, is_online=True, all_category_tag_list = CommunityCategoryTagRelation.objects.filter(tag_id__in=edit_tag_list, is_online=True,
is_deleted=False).values("category_tag_id") is_deleted=False).values_list(
"category_tag_id", flat=True)
##去掉明星,品牌,其他的分类
category_tag = []
for i in all_category_tag_list:
if i not in [707000, 348494, 18344]:
category_tag.append(i)
# 随机拿一个 # 随机拿一个
if len(all_category_tag_list) > 0: logging.info("get get_category_tag_id:%s" % category_tag)
index = randint(0, len(all_category_tag_list) - 1) if len(category_tag) > 0:
logging.info("get get_category_tag_id:%s" % all_category_tag_list[index]) index = randint(0, len(category_tag) - 1)
return all_category_tag_list[index] return category_tag[index]
else: else:
return 0 return 0
......
...@@ -77,13 +77,7 @@ def principal_online_comment1(): ...@@ -77,13 +77,7 @@ def principal_online_comment1():
majia_user_id = get_majia() majia_user_id = get_majia()
cook = logins(majia_user_id) cook = logins(majia_user_id)
comment = "" comment = ""
# 判断是不是编辑标签 comment = judge_pictorial_info_get_comment()
edit_judge = get_pictorial_tag_by_id(i[0])
if edit_judge:
# rand_tag_id = random.randint(0, len(edit_judge) - 1)
comment = judge_pictorial_info_get_comment(edit_judge)
else:
comment = get_pictorial_comment()
if cook is not None: if cook is not None:
pictorial_reply(cook, i[0], comment) pictorial_reply(cook, i[0], comment)
if data_vote: if data_vote:
...@@ -93,11 +87,7 @@ def principal_online_comment1(): ...@@ -93,11 +87,7 @@ def principal_online_comment1():
majia_user_id = get_majia() majia_user_id = get_majia()
cook = logins(majia_user_id) cook = logins(majia_user_id)
edit_judge = get_pictorial_tag_by_id(i[0]) edit_judge = get_pictorial_tag_by_id(i[0])
if edit_judge: comment = judge_pictorial_info_get_comment()
rand_tag_id = random.randint(0, len(edit_judge) - 1)
comment = get_pictorial_comment()
else:
comment = get_pictorial_comment()
if cook is not None: if cook is not None:
pictorial_reply(cook, i[0], comment) pictorial_reply(cook, i[0], comment)
......
...@@ -19,30 +19,16 @@ my_sender = 'lixiaofang@igengmei.com' ...@@ -19,30 +19,16 @@ my_sender = 'lixiaofang@igengmei.com'
my_pass = 'tg5AVKBB8jLQGBET' my_pass = 'tg5AVKBB8jLQGBET'
my_user6 = "lixiaofang@igengmei.com" my_user6 = "lixiaofang@igengmei.com"
# auto_click_url = "http://earth.gmapp.env/api/v1/like" auto_click_url = "http://earth.gmapp.env/api/v1/like"
# auto_reply_url = "http://earth.gmapp.env/api/v1/reply/create" auto_reply_url = "http://earth.gmapp.env/api/v1/reply/create"
# auto_follow_url = "http://earth.gmapp.env/api/v1/follow" auto_follow_url = "http://earth.gmapp.env/api/v1/follow"
# auto_urge_url = "http://earth.gmapp.env/api/v1/user/urge" auto_urge_url = "http://earth.gmapp.env/api/v1/user/urge"
# DATABASES = {
# 'default': { # auto_click_url = "http://earth.iyanzhi.com/api/v1/like"
# 'ENGINE': 'django.db.backends.mysql', # auto_reply_url = "http://earth.iyanzhi.com/api/v1/reply/create"
# 'NAME': 'alpha', # auto_follow_url = "http://earth.iyanzhi.com/api/v1/follow"
# 'USER': 'work', # auto_urge_url = "http://earth.iyanzhi.com/api/v1/user/urge"
# 'PASSWORD': 'Gengmei123!',
# 'HOST': 'bj-cdb-55ejhsjy.sql.tencentcdb.com',
# 'PORT': '62177',
# 'OPTIONS': {
# "init_command": "SET foreign_key_checks = 0;",
# "charset": "utf8mb4",
# },
# }
# }
auto_click_url = "http://earth.iyanzhi.com/api/v1/like"
auto_reply_url = "http://earth.iyanzhi.com/api/v1/reply/create"
auto_follow_url = "http://earth.iyanzhi.com/api/v1/follow"
auto_urge_url = "http://earth.iyanzhi.com/api/v1/user/urge"
host = DATABASES['default']['HOST'] host = DATABASES['default']['HOST']
...@@ -222,7 +208,6 @@ def get_comment(): ...@@ -222,7 +208,6 @@ def get_comment():
num = random.randint(0, len(list_guanshui)) num = random.randint(0, len(list_guanshui))
comment = list_guanshui[num - 1] comment = list_guanshui[num - 1]
return comment return comment
except: except:
...@@ -451,7 +436,6 @@ def pictorial_reply(cookies_get, id, content): ...@@ -451,7 +436,6 @@ def pictorial_reply(cookies_get, id, content):
logging.info("response.text:%s" % response.text) logging.info("response.text:%s" % response.text)
get_error(response.text, "pictorial_reply", id) get_error(response.text, "pictorial_reply", id)
except: except:
logging.error("catch exception,logins:%s" % traceback.format_exc()) logging.error("catch exception,logins:%s" % traceback.format_exc())
...@@ -466,10 +450,12 @@ def get_pictorial_comment(): ...@@ -466,10 +450,12 @@ def get_pictorial_comment():
comment = list_guanshui[num - 1] comment = list_guanshui[num - 1]
logging.info("get comment:%s" % comment)
return comment return comment
except: except:
logging.error("catch exception,logins:%s" % traceback.format_exc())
return None return None
...@@ -514,36 +500,46 @@ def get_category_reply_commtent(category_id): ...@@ -514,36 +500,46 @@ def get_category_reply_commtent(category_id):
# 发型42、穿搭46、美妆3、护肤4、美甲21972、香水17576、瘦身32605、配饰5305608 # 发型42、穿搭46、美妆3、护肤4、美甲21972、香水17576、瘦身32605、配饰5305608
file = "" file = ""
if category_id == 5305608: # 配饰 if category_id == 5305608: # 配饰
logging.info("5305608-------------")
file = "/srv/apps/physical/vest/data/accessories_reply_data.txt" file = "/srv/apps/physical/vest/data/accessories_reply_data.txt"
if category_id == 3: # 美妆 if category_id == 3: # 美妆
logging.info("3-------------")
file = "/srv/apps/physical/vest/data/beauty_reply_data.txt" file = "/srv/apps/physical/vest/data/beauty_reply_data.txt"
if category_id == 42: # 发型 if category_id == 42: # 发型
logging.info("42-------------")
file = "/srv/apps/physical/vest/data/hairstyle_reply_data.txt" file = "/srv/apps/physical/vest/data/hairstyle_reply_data.txt"
if category_id == 21972: # 美甲 if category_id == 21972: # 美甲
logging.info("21972-------------")
file = "/srv/apps/physical/vest/data/manicure_reply_data.txt" file = "/srv/apps/physical/vest/data/manicure_reply_data.txt"
if category_id == 17576: # 香水 if category_id == 17576: # 香水
logging.info("17576-------------")
file = "/srv/apps/physical/vest/data/perfume_reply_data.txt" file = "/srv/apps/physical/vest/data/perfume_reply_data.txt"
if category_id == 4: # 护肤 if category_id == 4: # 护肤
logging.info("4-------------")
file = "/srv/apps/physical/vest/data/skincare_reply_data.txt" file = "/srv/apps/physical/vest/data/skincare_reply_data.txt"
if category_id == 32605: # 瘦身 if category_id == 32605: # 瘦身
logging.info("32605-------------")
file = "/srv/apps/physical/vest/data/slimming_reply_data.txt" file = "/srv/apps/physical/vest/data/slimming_reply_data.txt"
if category_id == 46: # 穿搭 if category_id == 46: # 穿搭
file = "/srv/apps/physical/vest/data/wear_repy_data.txt" logging.info("46-------------")
file = "/srv/apps/physical/vest/data/wear_repy_data.txt"
data = open(file, "r") data = open(file, "r")
list_guanshui = [] list_guanshui = []
for i in data: for i in data:
list_guanshui.append(i) list_guanshui.append(i)
num = random.randint(0, len(list_guanshui)) num = random.randint(0, len(list_guanshui))
comment = list_guanshui[num - 1] comment = list_guanshui[num - 1]
logging.info("get comment:%s" % comment) logging.info("get comment:%s" % comment)
return comment return comment
except: except:
logging.error("catch exception,logins:%s" % traceback.format_exc())
return None return None
...@@ -552,6 +548,7 @@ def judge_topic_info_get_comment(topic_id): ...@@ -552,6 +548,7 @@ def judge_topic_info_get_comment(topic_id):
comment = "" comment = ""
# 先判断是不是编辑标签 # 先判断是不是编辑标签
edit_tag_list = get_edit_tag_id_list(topic_id) edit_tag_list = get_edit_tag_id_list(topic_id)
logging.info("get topic_tag:%s" % edit_tag_list)
if len(edit_tag_list) > 0: if len(edit_tag_list) > 0:
# 如果有编辑标签 # 如果有编辑标签
# 去拿他的所属分类 根据分类去拿对应的标签(随机拿一个) # 去拿他的所属分类 根据分类去拿对应的标签(随机拿一个)
...@@ -560,24 +557,33 @@ def judge_topic_info_get_comment(topic_id): ...@@ -560,24 +557,33 @@ def judge_topic_info_get_comment(topic_id):
comment = get_category_reply_commtent(category_tag_id) comment = get_category_reply_commtent(category_tag_id)
else: else:
product_judge = get_topic_product_info(topic_id) product_judge = get_topic_product_info(topic_id)
logging.info("get product_judge:%s" % product_judge)
if product_judge: if product_judge:
comment = get_product_comment() comment = get_product_comment()
else: else:
# 判断有没有人脸 # 判断有没有人脸
face_judge = topic_has_image(topic_id) face_judge = topic_has_image(topic_id)
logging.info("get face_judge:%s" % face_judge)
if face_judge: if face_judge:
comment = get_face_comment() comment = get_face_comment()
# 原始评论 # 原始评论
else: else:
comment = get_comment() comment = get_comment()
else: else:
# 判断有没有商品信息 # 判断有没有商品信息
product_judge = get_topic_product_info(topic_id) product_judge = get_topic_product_info(topic_id)
if product_judge: if product_judge:
comment = get_product_comment() comment = get_product_comment()
logging.info("get product_judge:%s" % product_judge)
else: else:
# 判断有没有人脸 # 判断有没有人脸
face_judge = topic_has_image(topic_id) face_judge = topic_has_image(topic_id)
logging.info("get face_judge:%s" % face_judge)
if face_judge: if face_judge:
comment = get_face_comment() comment = get_face_comment()
# 原始评论 # 原始评论
...@@ -587,10 +593,10 @@ def judge_topic_info_get_comment(topic_id): ...@@ -587,10 +593,10 @@ def judge_topic_info_get_comment(topic_id):
logging.info("get judge_topic_info_get_comment:%s" % comment) logging.info("get judge_topic_info_get_comment:%s" % comment)
return comment return comment
except: except:
logging.error("catch exception,logins:%s" % traceback.format_exc()) logging.error("catch exception,logins:%s" % traceback.format_exc())
return None return None
def judge_pictorial_info_get_comment(pictorial_id): def judge_pictorial_info_get_comment(pictorial_id):
try: try:
comment = "" comment = ""
...@@ -600,13 +606,15 @@ def judge_pictorial_info_get_comment(pictorial_id): ...@@ -600,13 +606,15 @@ def judge_pictorial_info_get_comment(pictorial_id):
# 如果有编辑标签 # 如果有编辑标签
# 去拿他的所属分类 根据分类去拿对应的标签(随机拿一个) # 去拿他的所属分类 根据分类去拿对应的标签(随机拿一个)
category_tag_id = get_category_tag_id(edit_tag_list) category_tag_id = get_category_tag_id(edit_tag_list)
logging.info("get category_tag_id:%s" % category_tag_id)
if category_tag_id > 0: if category_tag_id > 0:
comment = get_category_reply_commtent(category_tag_id) comment = get_category_reply_commtent(category_tag_id)
else: else:
logging.info("get -------------+++++++++++")
comment = get_pictorial_comment() comment = get_pictorial_comment()
else: else:
# 原始评论 # 原始评论
comment = get_comment() comment = get_pictorial_comment()
logging.info("get judge_topic_info_get_comment:%s" % comment) logging.info("get judge_topic_info_get_comment:%s" % comment)
return comment return comment
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment