Commit 158fdfec authored by 李小芳's avatar 李小芳

修改mapping

parent 0d019557
......@@ -35,7 +35,7 @@ from search.utils.area import get_nearby_city_tag
from helios.rpc.internal.default_invoker import create_default_invoker
from rpc.context import get_rpc_remote_invoker
from rpc.cache import common_cache as redis_client
from search.utils.es import get_es, es_index_adapt, es_indices_analyze,get_talos_es
from search.utils.es import get_es, es_index_adapt, es_indices_analyze
import traceback
from .es import tzlc, to_epoch,update_max_min
from doris.models.service import SubmissionCommodity, UnitRelateService, Promotion,PromotionRule,Submission, UnitActivity, Unit
......@@ -1265,7 +1265,7 @@ def get_old_tag_mapping_new_tag(fresh_tag_name_set, service_info_word):
def get_fresh_tag_name_list(fresh_tag_name_set, service_info_word):
try:
if service_info_word and len(service_info_word) > 0:
es = get_talos_es()
es = get_es()
body = {
'text': service_info_word,
'analyzer': "gm_default_index"
......@@ -1713,22 +1713,24 @@ def get_service(instance):
pass
# 添加地域TAG
closure_tag_city_id_list = list()
closure_tag_city_name_list = list()
try:
closure_tags.append(
Tag.objects.get(pk=s.doctor.hospital.city.tag_id)
)
city_obj = Tag.objects.get(pk=s.doctor.hospital.city.tag_id)
closure_tag_city_id_list = [city_obj.id]
closure_tag_city_name_list = [city_obj.name]
except (Tag.DoesNotExist, AttributeError):
pass
res['closure_tag_ids'] = [t.id for t in closure_tags]
res['closure_tags'] = [t.name for t in closure_tags]
res['closure_tags_by_standard_analyzer'] = [t.name for t in closure_tags]
res['closure_tag_ids'] = [t.id for t in closure_tags] + closure_tag_city_id_list
res['closure_tags'] = [t.name for t in closure_tags] + closure_tag_city_name_list
res['closure_tags_by_standard_analyzer'] = [t.name for t in closure_tags] + closure_tag_city_name_list
res["first_tags"] = list(
Tag.objects.filter(name__in=res['closure_tags'], tag_type='1').values_list('name', flat=True))
Tag.objects.filter(name__in=res['closure_tag_ids'], tag_type='1').values_list('name', flat=True))
res["second_tags"] = list(
Tag.objects.filter(name__in=res['closure_tags'], tag_type='2').values_list('name', flat=True))
res["third_tags"] = list(
Tag.objects.filter(name__in=res['closure_tags'], tag_type='3').values_list('name', flat=True))
Tag.objects.filter(name__in=res['closure_tags_by_standard_analyzer'], tag_type='3').values_list('name', flat=True))
try:
doris_redis = redis.StrictRedis.from_url(settings.DORIS_URL)
......@@ -1831,6 +1833,8 @@ def get_service(instance):
sku = []
fresh_tag_name_set = set()
get_fresh_tag_name_list(fresh_tag_name_set=fresh_tag_name_set, service_info_word=s.short_description)
spu_standarded = False
for p in sku_price_range_list:
from api.models.service import ServiceItem
parent_id = ServiceItem.objects.filter(id=p['sku_id'], parent_id=0).values_list("parent_id", flat=True).first()
......@@ -1850,8 +1854,8 @@ def get_service(instance):
'start_time': tzlc(p['start_time']),
'end_time': tzlc(p['end_time']),
"price": p['price'],
"name": p['name'],
"name_by_standard_analyzer": p['name'],
"name": p['name'] if not new_sku_name else new_sku_name,
"name_by_standard_analyzer": p['name'] if not new_sku_name else new_sku_name,
"sku_rank": p['sku_rank'],
"price_type": p['price_type'],
"new_sku_tags": new_sku_tags,
......@@ -1861,6 +1865,8 @@ def get_service(instance):
"materials": materials,
"new_sku_name": new_sku_name
}
if len(new_sku_name)>0:
spu_standarded = True
if int(p["sku_id"]) in sku_items_name_dict:
data["sku_item_names"] = sku_items_name_dict[int(p["sku_id"])]
promotion_info = get_submission_info(service_id=s.id, sku_id=p["sku_id"], price=p["price"])
......@@ -1905,6 +1911,15 @@ def get_service(instance):
get_fresh_tag_name_list(fresh_tag_name_set=fresh_tag_name_set, service_info_word=p["name"])
if spu_standarded:
res['bak_closure_tag_ids'] = closure_tag_city_id_list
res['bak_closure_tags'] = closure_tag_city_name_list
res['bak_closure_tags_by_standard_analyzer'] = closure_tag_city_name_list
else:
res['bak_closure_tag_ids'] = res['closure_tag_ids']
res['bak_closure_tags'] = res['closure_tags']
res['bak_closure_tags_by_standard_analyzer'] = res['closure_tags_by_standard_analyzer']
res['sku_list'] = sku
for old_tag_name in res['closure_tags']:
# get_old_tag_mapping_new_tag(fresh_tag_name_set=fresh_tag_name_set,service_info_word=old_tag_name)
......@@ -2032,6 +2047,15 @@ def get_service(instance):
rpc_client = invoker['artemis/cpc/is_promote'](service_id=instance.id)
res['is_promote'] = rpc_client.unwrap()
cur_time_value = int(time.time())
if res["is_sink"] \
or ("ticket_sink_start_time_long" in res and "ticket_sink_end_time_long" in res and res["ticket_sink_start_time_long"]<=cur_time_value and cur_time_value<res["ticket_sink_end_time_long"]) \
or (not res["is_can_be_sold"] or ("start_time_long" in res and res["start_time_long"]>cur_time_value) or ("end_time_log" in res and res["end_time_log"]<cur_time_value)) \
or ("org_sink_start_time_long" in res and res["org_sink_start_time_long"]<=cur_time_value and "org_sink_end_time_long" in res and cur_time_value<res["org_sink_end_time_long"]):
res["is_down_to_bottom"] = True
else:
res["is_down_to_bottom"] = False
# 新标签v3相关字段
(need_refresh_data,second_demands_set,second_solutions_set,second_positions_set,first_demands_set,first_solutions_set,
......
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