Commit f258418f by dong

fix20230404

parent 6d1656ef
......@@ -517,24 +517,44 @@ def consultation_list():
try:
cons_obj_list = CustomerConsultation.query.paginate(page, perpage).items
cons_count = CustomerConsultation.query.count()
data = [{
"id": cons_obj.id,
"project_name": cons_obj.project_name,
"investor": cons_obj.investor,
"investor_place": cons_obj.investor_place,
"project_type": cons_obj.project_type,
"investment_volume": cons_obj.investment_volume,
"basic_information": cons_obj.basic_information,
"land_area": cons_obj.land_area,
"linkman": cons_obj.linkman,
"link_mobile": cons_obj.link_mobile,
"flag": cons_obj.flag,
"reply_content": cons_obj.reply_content,
"consultation_time": cons_obj.consultation_time,
"reply_time": cons_obj.reply_time,
} for cons_obj in cons_obj_list]
data = sorted(data, key=lambda x: x['consultation_time'], reverse=True)
data_li = []
for cons_obj in cons_obj_list:
print(cons_obj)
data = {
"id": cons_obj.id,
"project_name": cons_obj.project_name,
"investor": cons_obj.investor,
"investor_place": cons_obj.investor_place,
"project_type": cons_obj.project_type,
"investment_volume": cons_obj.investment_volume,
"basic_information": cons_obj.basic_information,
"land_area": cons_obj.land_area,
"linkman": cons_obj.linkman,
"link_mobile": cons_obj.link_mobile,
"flag": cons_obj.flag,
"reply_content": cons_obj.reply_content,
"consultation_time": cons_obj.consultation_time.strftime("%Y-%m-%d") if cons_obj.consultation_time else "",
"reply_time": cons_obj.reply_time.strftime("%Y-%m-%d") if cons_obj.reply_time else "",
}
data_li.append(data)
# data = [{
# "id": cons_obj.id,
# "project_name": cons_obj.project_name,
# "investor": cons_obj.investor,
# "investor_place": cons_obj.investor_place,
# "project_type": cons_obj.project_type,
# "investment_volume": cons_obj.investment_volume,
# "basic_information": cons_obj.basic_information,
# "land_area": cons_obj.land_area,
# "linkman": cons_obj.linkman,
# "link_mobile": cons_obj.link_mobile,
# "flag": cons_obj.flag,
# "reply_content": cons_obj.reply_content,
# "consultation_time": cons_obj.consultation_time.strftime("%Y-%m-%d") if cons_obj.consultation_time else "",
# "reply_time": cons_obj.reply_time.strftime("%Y-%m-%d") if cons_obj.reply_time else "",
# } for cons_obj in cons_obj_list]
data = sorted(data_li, key=lambda x: x["consultation_time"], reverse=True)
except Exception as e:
current_app.logger.error(e)
return jsonify(code=RET.SESSIONERR, msg="Query error!")
......
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