Commit d02f3514 authored by 李小芳's avatar 李小芳

修改mapping

parent 158fdfec
......@@ -35,11 +35,12 @@ 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
from search.utils.es import get_es, es_index_adapt, es_indices_analyze,get_talos_es
import traceback
from .es import tzlc, to_epoch,update_max_min
from doris.models.service import SubmissionCommodity, UnitRelateService, Promotion,PromotionRule,Submission, UnitActivity, Unit
from gm_types.poseidon import VisualUnitRelatedServiceType,CommodityAuditStatus
from .es import tzlc, to_epoch, update_max_min
from doris.models.service import SubmissionCommodity, UnitRelateService, Promotion, PromotionRule, Submission, \
UnitActivity, Unit
from gm_types.poseidon import VisualUnitRelatedServiceType, CommodityAuditStatus
from django.db.models import Q
from rpc.tool.log_tool import logging_exception
from gm_types.poseidon.visual import UnitType
......@@ -49,7 +50,6 @@ import redis
from api.models.commodity_info import CommodityCategoryPropertyRelation
from api.manager.service_info_manager import get_register_sku_id_to_sku_name_info
MARS_API_HOST = settings.DATA_TRANSFER_MARS_API_HOST
MARS_AUTH_KEY = settings.DATA_TRANSFER_MARS_AUTH_KEY
......@@ -63,11 +63,13 @@ ORDER_BOUGHT_STATUS = [
from agile.services.tag import (TagMapOldTagService, get_tag_v3_first_demands_by_tag_v3_ids,
get_tag_v3_first_solutions_by_tag_v3_ids, get_tag_v3_names_by_tag_v3_ids,
get_tag_v3_positions_by_tag_v3_ids, get_tag_v3_second_demands_by_tag_v3_ids,
get_tag_v3_second_solutions_by_tag_v3_ids,get_tagv3_analysis_info,get_tagv3_ids_by_tagv3_names,
get_tag_v3_second_solutions_by_tag_v3_ids, get_tagv3_analysis_info,
get_tagv3_ids_by_tagv3_names,
get_tag_v3_first_positions_by_tag_v3_ids,
get_tag_v3_first_positions_by_tag_v3_ids,
get_first_demand_ids_by_name,get_second_demand_ids_by_name,get_first_position_ids_by_name,get_second_position_ids_by_name,
get_first_solution_ids_by_name,get_second_solution_ids_by_name)
get_first_demand_ids_by_name, get_second_demand_ids_by_name,
get_first_position_ids_by_name, get_second_position_ids_by_name,
get_first_solution_ids_by_name, get_second_solution_ids_by_name)
class MarsDataError(Exception):
......@@ -1239,7 +1241,7 @@ def get_fresh_tag_dict():
def get_old_tag_mapping_new_tag(fresh_tag_name_set, service_info_word):
try:
if service_info_word and len(service_info_word) > 0:
es = get_es()
es = get_talos_es()
body = {
'text': service_info_word,
'analyzer': "gm_default_index"
......@@ -1265,7 +1267,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_es()
es = get_talos_es()
body = {
'text': service_info_word,
'analyzer': "gm_default_index"
......@@ -1288,6 +1290,7 @@ def get_fresh_tag_name_list(fresh_tag_name_set, service_info_word):
logging.error("catch exception,err_msg:%s" % traceback.format_exc())
return False
def get_doctor_merchant_rank(merchant_doctor_id):
from statistic.models import MerchantUpgradeIndic
from statistic.models import MerchantUpgradeIndicAvg
......@@ -1393,11 +1396,13 @@ def get_windows_and_promotion(sku_id):
# promotion_results += [X.promotion_id for X in UnitActivity.objects.filter(unit=window_id)]
for promotion_info in SubmissionCommodity.objects.using(settings.POSEIDON_DB_NAME).filter(commodity_id=sku_id):
submission_status = Submission.objects.using(settings.POSEIDON_DB_NAME).get(id=promotion_info.submission_id).audit_status
submission_status = Submission.objects.using(settings.POSEIDON_DB_NAME).get(
id=promotion_info.submission_id).audit_status
if promotion_info.deleted == 0 and submission_status == 3:
promotion_id = promotion_info.promotion_id
promotion_results += [promotion_id]
window_results += [X.unit_id for X in UnitActivity.objects.using(settings.POSEIDON_DB_NAME).filter(promotion_id=promotion_id)]
window_results += [X.unit_id for X in
UnitActivity.objects.using(settings.POSEIDON_DB_NAME).filter(promotion_id=promotion_id)]
window_ids = []
promotion_ids = []
......@@ -1498,7 +1503,7 @@ def lbs_unit_info(instance):
window_ids = []
promotion_ids = []
for unit_info in UnitRelateService.objects.using(settings.POSEIDON_DB_NAME)\
for unit_info in UnitRelateService.objects.using(settings.POSEIDON_DB_NAME) \
.filter(service_id=service_id, related_type=VisualUnitRelatedServiceType.SPU):
try:
window_id = unit_info.unit_id
......@@ -1701,7 +1706,6 @@ def get_service(instance):
exclude_init=False,
is_online_only=True)
# 添加公立/私立TAG
try:
tag_id = settings.PUBLIC_TAG_ID if s.doctor.hospital.hospital_type == HOSPITAL_TYPE.PUBLIC else settings.PRIVATE_TAG_ID
......@@ -1716,7 +1720,7 @@ def get_service(instance):
closure_tag_city_id_list = list()
closure_tag_city_name_list = list()
try:
city_obj = 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):
......@@ -1730,14 +1734,31 @@ def get_service(instance):
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_by_standard_analyzer'], 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)
ai_spus = json.loads(doris_redis.get("search_spu"))
if ai_spus and res["id"] in ai_spus:
res["ai_tags"] = ['面部分析','脸部分析', '美颜相机','ai肤质分析','整形模拟器', '打分','新氧', '我是什么脸型?', '侧脸型', '拍照', '妆', '换发型', '明星脸','模拟整容','发型分析', '换脸','优雅知性脸', '发型测试', '发型设计', '看自己脸型', '妆容测试', '一键测肤', '脸不对称', '测脸型','测发型', '妆容分析', '脸型发型', '适合什么发型','测', '小脸', '查脸型', '贴纸', '测刘海', '照相', 'AI测试', '模拟', 'AI', '拍照片', '芯氧', '拍摄', '杏仁眼', '脸型', '爱豆脸', '侧脸', '扫脸', '我的脸型适合什么发型', '脸型测发型', '适合什么发型?', '磨皮', '颜值','测脸', '怎么侧脸', '面部识别', '你的脸型适合什么发型', '全脸', '分析脸型',
'修图', '童颜', '如何测脸型', 'ai侧脸', '脸型配发型', '指甲','测脸型适合什么发型','圆脸适合什么发型', '脸部检测', '拍照', '测五官', '检测脸型', '适合的发型', '照相机', '拍照测脸型', '杏眼', '识别脸型', '整容模拟器', '新氧魔镜测脸', '免费测脸型', 'P图', '改脸型','方脸发型', '查看脸型', '适合自己的发型', '鹅蛋脸发型', '发型', '测福气', '脸型报告', '镜子', '新氧魔镜', '脸部不对称', '相机', '测颜值', '皮肤测试', '測臉型', '自拍', '怎么看脸型', '看看我适合什么发型', '批图', '照片','护肤日记', '测量脸型', '眼型', '发色', '照相机', '测发型','果汁少女脸', '脸型什么发型', '口红王子投票', '脸型适合什么头型', '模拟器', '脸型适合的发型', '怎么测发型', '合适发型', '测妆容', '测试发型', 'ai测脸','魔滴', '更美模拟器', '英气玫瑰脸','适合妆容', '适合什么样的发型', '手术瘦脸', '仙甜脸','脸型决定发型', '测眉形', '方脸适合什么发型','魔镜侧脸','看脸', '测评', '测试', '文艺优雅脸','测明星脸', '魔镜', '设计发型', '脸型判断', '拍脸型', '检测','轻甜少女脸', '测测', '我要拍照', '颜值打分','试发型', '怎么测脸型', '我是什么脸', '长脸发型', 'Al测脸', '模拟整形', '侧脸功能', '适合发型', '相机', '面孔起源', '评分', '脸型', '面部测试', '颜值报告', '脸型适合什么发型', '侧脸形','测试脸型','选发型', '墨镜侧脸','娃娃脸适合什么发型', '魔镜', '发型检测','左右脸不对称','测皮肤','男士发型','测一测','测试脸', '看我适合什么发型', '颜值检测','适合什么妆', '测测你是什么脸', '三庭五眼', '发型', '明艳娇媚脸','脸型测试', '网红脸', '冷艳古典脸', '长脸适合什么发型', '更美ai', '烫发','染发', '侧脸','皮肤检测','测脸部', '扎头发', '测脸型','颜值分析','肤质测试']
res["ai_tags"] = ['面部分析', '脸部分析', '美颜相机', 'ai肤质分析', '整形模拟器', '打分', '新氧', '我是什么脸型?', '侧脸型', '拍照', '妆', '换发型',
'明星脸', '模拟整容', '发型分析', '换脸', '优雅知性脸', '发型测试', '发型设计', '看自己脸型', '妆容测试', '一键测肤', '脸不对称',
'测脸型', '测发型', '妆容分析', '脸型发型', '适合什么发型', '测', '小脸', '查脸型', '贴纸', '测刘海', '照相', 'AI测试', '模拟',
'AI', '拍照片', '芯氧', '拍摄', '杏仁眼', '脸型', '爱豆脸', '侧脸', '扫脸', '我的脸型适合什么发型', '脸型测发型', '适合什么发型?',
'磨皮', '颜值', '测脸', '怎么侧脸', '面部识别', '你的脸型适合什么发型', '全脸', '分析脸型',
'修图', '童颜', '如何测脸型', 'ai侧脸', '脸型配发型', '指甲', '测脸型适合什么发型', '圆脸适合什么发型', '脸部检测', '拍照', '测五官',
'检测脸型', '适合的发型', '照相机', '拍照测脸型', '杏眼', '识别脸型', '整容模拟器', '新氧魔镜测脸', '免费测脸型', 'P图', '改脸型',
'方脸发型', '查看脸型', '适合自己的发型', '鹅蛋脸发型', '发型', '测福气', '脸型报告', '镜子', '新氧魔镜', '脸部不对称', '相机',
'测颜值', '皮肤测试', '測臉型', '自拍', '怎么看脸型', '看看我适合什么发型', '批图', '照片', '护肤日记', '测量脸型', '眼型', '发色',
'照相机', '测发型', '果汁少女脸', '脸型什么发型', '口红王子投票', '脸型适合什么头型', '模拟器', '脸型适合的发型', '怎么测发型', '合适发型',
'测妆容', '测试发型', 'ai测脸', '魔滴', '更美模拟器', '英气玫瑰脸', '适合妆容', '适合什么样的发型', '手术瘦脸', '仙甜脸',
'脸型决定发型', '测眉形', '方脸适合什么发型', '魔镜侧脸', '看脸', '测评', '测试', '文艺优雅脸', '测明星脸', '魔镜', '设计发型',
'脸型判断', '拍脸型', '检测', '轻甜少女脸', '测测', '我要拍照', '颜值打分', '试发型', '怎么测脸型', '我是什么脸', '长脸发型',
'Al测脸', '模拟整形', '侧脸功能', '适合发型', '相机', '面孔起源', '评分', '脸型', '面部测试', '颜值报告', '脸型适合什么发型',
'侧脸形', '测试脸型', '选发型', '墨镜侧脸', '娃娃脸适合什么发型', '魔镜', '发型检测', '左右脸不对称', '测皮肤', '男士发型', '测一测',
'测试脸', '看我适合什么发型', '颜值检测', '适合什么妆', '测测你是什么脸', '三庭五眼', '发型', '明艳娇媚脸', '脸型测试', '网红脸',
'冷艳古典脸', '长脸适合什么发型', '更美ai', '烫发', '染发', '侧脸', '皮肤检测', '测脸部', '扎头发', '测脸型', '颜值分析',
'肤质测试']
except:
logging_exception()
......@@ -1865,7 +1886,7 @@ def get_service(instance):
"materials": materials,
"new_sku_name": new_sku_name
}
if len(new_sku_name)>0:
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"])]
......@@ -2034,7 +2055,6 @@ def get_service(instance):
res['merchant_doctor_rank'] = 0.0
logging.error("catch exception,err_msg:%s" % traceback.format_exc())
# add nearby city tags
res['nearby_city_tags'] = []
if s.doctor and s.doctor.hospital and s.doctor.hospital.city:
......@@ -2047,23 +2067,27 @@ 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"]):
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,
first_positions_set,project_tags_set,first_classify_ids_set,second_classify_ids_set,first_classify_names_set,
second_classify_names_set)=get_tagv3_analysis_info(content_id=res["id"],content_type="service")
(need_refresh_data, second_demands_set, second_solutions_set, second_positions_set, first_demands_set,
first_solutions_set,
first_positions_set, project_tags_set, first_classify_ids_set, second_classify_ids_set, first_classify_names_set,
second_classify_names_set) = get_tagv3_analysis_info(content_id=res["id"], content_type="service")
if need_refresh_data:
tagv3_ids = list()
if len(project_tags_set)>0:
if len(project_tags_set) > 0:
tagv3_ids = get_tagv3_ids_by_tagv3_names(names_list=list(project_tags_set))
first_demands_set = first_demands_set.union(set(get_tag_v3_first_demands_by_tag_v3_ids(tagv3_ids)))
first_solutions_set = first_solutions_set.union(set(get_tag_v3_first_solutions_by_tag_v3_ids(tagv3_ids)))
......@@ -2105,6 +2129,7 @@ def get_service(instance):
return res
def get_submission_info(service_id, sku_id, price):
ret = {
"promotion_price": 999999,
......@@ -2113,7 +2138,8 @@ def get_submission_info(service_id, sku_id, price):
"sort_price": price
}
try:
row = SubmissionCommodity.objects.filter(service_id=service_id, commodity_id=sku_id, is_valid=1).order_by('activity_price').first()
row = SubmissionCommodity.objects.filter(service_id=service_id, commodity_id=sku_id, is_valid=1).order_by(
'activity_price').first()
if row:
ret["promotion_price"] = row.activity_price
ret["submission_id"] = row.submission_id
......@@ -2140,27 +2166,28 @@ def get_new_sku_tags(sku_id):
if sku_model:
tag_info = sku_model.category_info()
if tag_info:
tags = [item.get("name","") for item in tag_info]
tags = [item.get("name", "") for item in tag_info]
except Exception as e:
logging_exception()
return tags
#add standrad sku by zgd
# add standrad sku by zgd
def get_instrument_and_materials(sku_id):
materials = ""
instrument = ""
try:
instrument_obj = CommodityCategoryPropertyRelation.objects.filter(commodity_id=sku_id,property_type=2,is_online=1).first()
instrument_obj = CommodityCategoryPropertyRelation.objects.filter(commodity_id=sku_id, property_type=2,
is_online=1).first()
if instrument_obj:
instrument = instrument_obj.property_name
materials_obj = CommodityCategoryPropertyRelation.objects.filter(commodity_id=sku_id,property_type=3,is_online=1).first()
materials_obj = CommodityCategoryPropertyRelation.objects.filter(commodity_id=sku_id, property_type=3,
is_online=1).first()
if materials_obj:
materials = materials_obj.property_name
except Exception as e:
logging_exception()
return instrument,materials
return instrument, materials
def get_sku_standard_new_sku_name(sku_id):
......@@ -2169,10 +2196,11 @@ def get_sku_standard_new_sku_name(sku_id):
try:
property_id = ServiceItem.objects.get(id=sku_id).property_id
if property_id:
tmp = get_register_sku_id_to_sku_name_info([property_id]).get(str(property_id),{}).get("property_infos",[])
tmp = get_register_sku_id_to_sku_name_info([property_id]).get(str(property_id), {}).get("property_infos",
[])
if tmp:
for item in tmp:
new_sku_name = new_sku_name + " " + item.get("value","") + " " + item.get("alias","")
new_sku_name = new_sku_name + " " + item.get("value", "") + " " + item.get("alias", "")
except Exception as e:
logging_exception()
return new_sku_name
......@@ -3,7 +3,7 @@ from api.models.hera import SpecialPool
from .es import tzlc
import logging
from api.models.city import City
from search.utils.es import get_es, get_highlight, es_index_adapt, tzlc, get_highlight_query
from search.utils.es import get_es, get_highlight, es_index_adapt, tzlc, get_highlight_query,get_talos_es
from rpc.tool.log_tool import search_logger, info_logger
from django.conf import settings
import traceback
......
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