Commit dda3c2a7 by dong

fix202302015

parent 73693353
...@@ -239,7 +239,8 @@ def search(): ...@@ -239,7 +239,8 @@ def search():
try: try:
es = Elasticsearch([{'host': '39.100.39.50', 'port': 9200}]) es = Elasticsearch([{'host': '39.100.39.50', 'port': 9200}])
data = es.search(index="jincheng_pictext_index_202301131004_a6181e52", body=body) # data = es.search(index="jincheng_pictext_index_202301131004_a6181e52", body=body)
data = es.search(index="jincheng_pictext_index_202302151628_bedd5ee8", body=body)
data_list = [] data_list = []
# print(data_list) # print(data_list)
size = data["hits"]['total'] size = data["hits"]['total']
......
...@@ -90,24 +90,18 @@ def get_cluster(): ...@@ -90,24 +90,18 @@ def get_cluster():
def industry_cluster(): def industry_cluster():
req_dic = request.get_json() req_dic = request.get_json()
industry_name = req_dic['industry_name'] industry_name = req_dic['industry_name']
# industry_id = req_dic['industry_id']
flag = req_dic['flag'] flag = req_dic['flag']
# # 查询redis
# try:
# result = redis_store.get('industry_id_{}'.format(industry_id)).decode()
# except Exception as e:
# current_app.logger.error(e)
# return jsonify(code=RET.DBERR, msg="redis数据库异常")
try: try:
industry_obj = IndustryChain.query.filter_by(industry_name=industry_name).first() industry_obj = IndustryChain.query.filter_by(industry_name=industry_name).first()
industry_id = industry_obj.id industry_id = industry_obj.id
chain_id = industry_obj.chain_id chain_id = industry_obj.chain_id
# 查询redis
result = redis_store.get('chain_id_{}'.format(industry_id)) if flag == 2:
if result: # 查询redis
return jsonify(code=RET.OK, msg="获取成功", data=json.loads(result)) result = redis_store.get('chain_id_{}'.format(industry_id))
if result:
return jsonify(code=RET.OK, msg="获取成功", data=json.loads(result))
result = { result = {
"industryChain": industry_name, "industryChain": industry_name,
"nodeList": [find_up_thr1(chain_id, 1, industry_id, flag), "nodeList": [find_up_thr1(chain_id, 1, industry_id, flag),
...@@ -117,14 +111,14 @@ def industry_cluster(): ...@@ -117,14 +111,14 @@ def industry_cluster():
except Exception as e: except Exception as e:
current_app.logger.error(e) current_app.logger.error(e)
return jsonify(code=RET.DBERR, msg="数据异常") return jsonify(code=RET.DBERR, msg="数据异常")
if flag == 2:
try: try:
redis_store.setex("chain_id_%s" % industry_id, constants.INDUSTRY_ENTERPRISE_REDIS_EXPIRES, json.dumps(result)) redis_store.setex("chain_id_%s" % industry_id, constants.INDUSTRY_ENTERPRISE_REDIS_EXPIRES, json.dumps(result))
# 保存发送给这个手机号的记录,防止用户在60s内再次出发发送短信的操作 # 保存发送给这个手机号的记录,防止用户在60s内再次出发发送短信的操作
# redis_store.setex("send_sms_code_%s" % mobile, constants.SEND_SMS_CODE_INTERVAL, 1) # redis_store.setex("send_sms_code_%s" % mobile, constants.SEND_SMS_CODE_INTERVAL, 1)
except Exception as e: except Exception as e:
current_app.logger.error(e) current_app.logger.error(e)
return jsonify(code=RET.DBERR, msg="保存产业/企业数量信息异常") return jsonify(code=RET.DBERR, msg="保存产业/企业数量信息异常")
return jsonify(code=RET.OK, msg="获取成功", data=result) return jsonify(code=RET.OK, msg="获取成功", data=result)
......
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