Commit 9899ea77 authored by zwild's avatar zwild

topic detail order

parent 76dd662e
# -*- coding: UTF-8 -*-
# !/usr/bin/env python
from kafka import KafkaConsumer
import random
from libs.cache import redis_client
......@@ -633,7 +630,7 @@ class CollectData(object):
logging.info("action=api/v1/cards/topic")
tag_name = data["APP"].get("query", [])
tag_list = list(Tag.objects.using(settings.SLAVE1_DB_NAME).filter(
name=tag_name).values_list("id"))
name=tag_name).values_list("id", flat=True))
device_id = data["SYS"]["cl_id"]
user_id = data['SYS'].get('user_id', None)
self.transfer_update_recommend_tag_list(device_id, user_feature, user_id,
......@@ -651,7 +648,7 @@ class CollectData(object):
tag_ids = list(data["APP"].get("tag_ids", []))
tag_list = list(Tag.objects.using(settings.SLAVE1_DB_NAME).filter(
id__in=tag_ids, is_online=True, is_deleted=False,
is_category=False).values_list("id"))
is_category=False).values_list("id", flat=True))
device_id = data["SYS"]["cl_id"]
user_id = data['SYS'].get('user_id', None)
self.transfer_update_recommend_tag_list(device_id, user_feature, user_id,
......@@ -668,7 +665,7 @@ class CollectData(object):
tag_ids = list(data["APP"].get("tag_ids", []))
tag_list = list(Tag.objects.using(settings.SLAVE1_DB_NAME).filter(
id__in=tag_ids, is_online=True, is_deleted=False,
is_category=False).values_list("id"))
is_category=False).values_list("id", flat=True))
device_id = data["SYS"]["cl_id"]
user_id = data['SYS'].get('user_id', None)
self.transfer_update_recommend_tag_list(device_id, user_feature, user_id,
......@@ -685,7 +682,7 @@ class CollectData(object):
logging.info('action:%s,tag_list:%s' % (action, str(tag_ids)))
tag_query_results = list(Tag.objects.using(settings.SLAVE1_DB_NAME).filter(
id__in=tag_ids, is_online=True, is_deleted=False,
is_category=False).values_list("id"))
is_category=False).values_list("id", flat=True))
tag_query_results = [i[0] for i in tag_query_results]
logging.info('action:%s,mysql query taglist:%s' % (action, str(tag_query_results)))
tag_query_results_multi = [i for i in tag_ids if i in tag_query_results]
......
......@@ -359,7 +359,7 @@ def pictorial_topic_sort(pictorial_id=-1, offset=0, size=10, sort_type=PICTORIAL
if sort_type == PICTORIAL_TOPIC_SORT.HOT:
q["sort"] = [
{"related_billboard.total_vote_cnt": {
{"related_billboard.real_vote_cnt": {
"order": "desc",
"nested_path": "related_billboard",
"missing": "_last",
......@@ -403,7 +403,7 @@ def pictorial_topic_sort(pictorial_id=-1, offset=0, size=10, sort_type=PICTORIAL
# }}
# ]
q["sort"] = [
{"related_billboard.total_vote_cnt": {
{"related_billboard.real_vote_cnt": {
"order": "desc",
"nested_path": "related_billboard",
"missing": "_last",
......
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