Commit 00724a1a authored by 李小芳's avatar 李小芳

更新es的配置

parent 2ce33374
......@@ -1400,8 +1400,8 @@ class Diary(models.Model):
def get_script_diary_index_2(self, index_limit_start_time, index_limit_end_time, index_limit_weight2):
try:
limit_weight = 1
start_time = int(time.mktime(tzlc(index_limit_start_time).timetuple()))
end_time = int(time.mktime(tzlc(index_limit_end_time).timetuple()))
start_time = int(time.mktime(index_limit_start_time.timetuple()))
end_time = int(time.mktime(index_limit_end_time.timetuple()))
now = int(time.time())
if start_time <= now and now <= end_time:
limit_weight = index_limit_weight2
......@@ -1412,8 +1412,8 @@ class Diary(models.Model):
def get_merchant_sink(self, merchant_sink_start_time, merchant_sink_end_time):
try:
start_time = int(time.mktime(tzlc(merchant_sink_start_time).timetuple()))
end_time = int(time.mktime(tzlc(merchant_sink_end_time).timetuple()))
start_time = int(time.mktime(merchant_sink_start_time.timetuple()))
end_time = int(time.mktime(merchant_sink_end_time.timetuple()))
now = int(time.time())
if start_time <= now and now <= end_time:
return 0
......
......@@ -584,18 +584,16 @@ def get_diary(instance):
res['anecdote_tag_ids'] = get_tag_v3_anecdote_tag_ids(content_id=d.id)
res['greatest_hits'] = d.get_greatest_hits(is_headline=d.is_headline, closure_tag_ids=res['closure_tag_ids'])
res['tag_id_popular'] = 1 if 1202 in res['closure_tag_ids'] else 0
index_limit_start_time = res.get("index_limit_start_time", None)
index_limit_end_time = res.get("index_limit_start_time", None)
index_limit_weight2 = res.get("index_limit_weight2", None)
if index_limit_start_time and index_limit_end_time:
res['index_limit_score'] = d.get_script_diary_index_2(index_limit_start_time, index_limit_end_time,
index_limit_weight2)
if "index_limit_start_time" in res and "index_limit_end_time" in res and "index_limit_weight2" in res:
res['index_limit_score'] = d.get_script_diary_index_2(res['index_limit_start_time'],
res['index_limit_end_time'],
res['index_limit_weight2'])
else:
res['index_limit_score'] = 1
merchant_sink_start_time = res.get("merchant_sink_start_time", None)
merchant_sink_end_time = res.get("merchant_sink_end_time", None)
if merchant_sink_start_time and merchant_sink_end_time:
res['merchant_sink'] = d.get_merchant_sink(merchant_sink_start_time, merchant_sink_end_time)
if "merchant_sink_start_time" in res and "merchant_sink_end_time" in res:
res['merchant_sink'] = d.get_merchant_sink(res['merchant_sink_start_time'], res['merchant_sink_end_time'])
else:
res['merchant_sink'] = 1
......
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