Commit a6894792 authored by lixiaofang's avatar lixiaofang

add

parent fcf04bf8
This diff is collapsed.
......@@ -12,8 +12,8 @@ from django.db import models
def get_edit_tag_id_list(topic_id):
try:
tag_id_list = list(TopicTag.objects.using(settings.SLAVE_DB_NAME).filter(topic_id=topic_id,
is_collection=1).values_list("tag_id",
flat=True))
is_collection=1).values_list("tag_id",
flat=True))
logging.info("get ---tag_id_list:%s" % tag_id_list)
logging.info("get ---topic_id:%s" % topic_id)
......@@ -23,6 +23,18 @@ def get_edit_tag_id_list(topic_id):
return []
def get_tag_id_list(topic_id):
try:
tag_id_list = list(
TopicTag.objects.using(settings.SLAVE_DB_NAME).filter(topic_id=topic_id, tag_id=123).values_list("tag_id",
flat=True))
return tag_id_list
except:
logging.error("catch exception,err_msg:%s" % traceback.format_exc())
return []
def topic_has_image(topic_id):
try:
has_image = Topic.objects.using(settings.SLAVE_DB_NAME).filter(id=topic_id, is_deleted=False,
......
......@@ -13,7 +13,7 @@ from email.utils import formataddr
from physical.settings_local import DATABASES
from physical.settings_local import REDIS_URL
from vest.data.topic_models import get_pictorial_tag_by_id, get_topic_product_info, get_edit_tag_id_list, \
get_category_tag_id, topic_has_image
get_category_tag_id, topic_has_image, get_tag_id_list
from django.conf import settings
my_sender = 'lixiaofang@igengmei.com'
......@@ -493,6 +493,24 @@ def get_face_comment():
return None
def get_hellolike_comment():
try:
data = open("/srv/apps/physical/vest/data/hellolike.txt.txt", "r")
list_guanshui = []
for i in data:
list_guanshui.append(i)
num = random.randint(0, len(list_guanshui))
comment = list_guanshui[num - 1]
return comment
except:
return None
def get_category_reply_commtent(category_id):
try:
# 发型42、穿搭46、美妆3、护肤4、美甲21972、香水17576、瘦身32605、配饰5305608
......@@ -531,7 +549,11 @@ def judge_topic_info_get_comment(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:
tag_list = get_tag_id_list(topic_id)
if len(tag_list) > 0:
comment = get_hellolike_comment()
elif len(edit_tag_list) > 0:
# 如果有编辑标签
# 去拿他的所属分类 根据分类去拿对应的标签(随机拿一个)
category_tag_id = get_category_tag_id(edit_tag_list)
......@@ -554,6 +576,7 @@ def judge_topic_info_get_comment(topic_id):
else:
comment = get_comment()
else:
# 判断有没有商品信息
product_judge = get_topic_product_info(topic_id)
......
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