Commit 9a235574 authored by lixiaofang's avatar lixiaofang

add

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