Commit 9a235574 authored by lixiaofang's avatar lixiaofang

add

parent bf31278b
......@@ -100,7 +100,7 @@ class QueryWordAttr(object):
@classmethod
def get_hot_search_query_word_weight(cls, name):
try:
search_num = StrategyHistoryQueryWords.objects.filter(keyword=name, is_delete=0).values_list(
search_num = StrategyHistoryQueryWords.objects.filter(keyword=name).values_list(
"search_num", flat=True).first()
return search_num * 0.01
......@@ -178,9 +178,9 @@ class QueryWordAttr(object):
def get_search_query_results_num(cls, name):
try:
total_num = 0
data = StrategyHistoryQueryWords.objects.filter(keyword=name, is_delete=0).values("answer_num",
"tractate_num",
"diary_num").first()
data = StrategyHistoryQueryWords.objects.filter(keyword=name).values("answer_num",
"tractate_num",
"diary_num").first()
for value in data.values():
total_num += value
return total_num
......
......@@ -19,13 +19,10 @@ class SearchWord(object):
item_dict["id"] = getMd5Digest(str(instance.keyword))
item_dict["ori_name"] = instance.keyword
is_online = False
if not QueryWordAttr.get_search_query_results_num(instance.keyword):
is_online == False
if QueryWordAttr.get_search_query_results_num(instance.keyword):
is_online = False if instance.is_delete else True
else:
if instance.is_delete == False:
is_online == True
else:
is_online == False
is_online == False
item_dict["is_online"] = is_online
item_dict["order_weight"] = QueryWordAttr.get_hot_search_query_word_weight(instance.keyword)
......
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