Commit 7106b95d by dong

fix20230331

parent eb1392ba
...@@ -413,14 +413,13 @@ def attract_enterprise(): ...@@ -413,14 +413,13 @@ def attract_enterprise():
return jsonify(code=RET.PARAMERR, msg="参数不完整") return jsonify(code=RET.PARAMERR, msg="参数不完整")
try: try:
if not product:
enterprise = Enterprise.query.filter(or_( enterprise = Enterprise.query.filter(or_(
Enterprise.c_type == inid, Enterprise.c_type == inid,
Enterprise.c_type1 == inid, Enterprise.c_type1 == inid,
Enterprise.c_type2 == inid Enterprise.c_type2 == inid
)) ))
enterprise_obj = enterprise.filter( enterprise = enterprise.filter(
# Enterprise.product_all.like("%{}%".format(product)) if product else text(''), # Enterprise.product_all.like("%{}%".format(product)) if product else text(''),
Enterprise.entype.like('%{}%'.format(entype)) if entype else text(''), Enterprise.entype.like('%{}%'.format(entype)) if entype else text(''),
Enterprise.company_name.like('%{}%'.format(company_name)) if company_name else text(''), Enterprise.company_name.like('%{}%'.format(company_name)) if company_name else text(''),
...@@ -447,12 +446,9 @@ def attract_enterprise(): ...@@ -447,12 +446,9 @@ def attract_enterprise():
for product in product_li: for product in product_li:
enterprise2 = '' enterprise2 = ''
enterprise2 = enterprise.filter(or_( enterprise2 = enterprise.filter(or_(
(Enterprise.product_all.like("%{}%".format(product)), Enterprise.product_all.like("%{}%".format(product)),
Enterprise.c_type == inid), Enterprise.product_all1.like("%{}%".format(product)),
(Enterprise.product_all1.like("%{}%".format(product)), Enterprise.product_all2.like("%{}%".format(product))
Enterprise.c_type1 == inid),
(Enterprise.product_all2.like("%{}%".format(product)),
Enterprise.c_type2 == inid)
)).all() )).all()
company1 += enterprise2 company1 += enterprise2
company1 = set(company1) company1 = set(company1)
...@@ -460,8 +456,8 @@ def attract_enterprise(): ...@@ -460,8 +456,8 @@ def attract_enterprise():
company1 = sorted(company1, key=lambda x: x.hots, reverse=True) # 排序 company1 = sorted(company1, key=lambda x: x.hots, reverse=True) # 排序
enterprise_obj_list = company1[(page - 1) * perpage:page * perpage] # 分页 enterprise_obj_list = company1[(page - 1) * perpage:page * perpage] # 分页
else: else:
size = enterprise_obj.count() size = enterprise.count()
enterprise_obj_list = enterprise_obj.order_by(Enterprise.hots.desc()).paginate(page, perpage).items enterprise_obj_list = enterprise.order_by(Enterprise.hots.desc()).paginate(page, perpage).items
df = [{"id": i.id, df = [{"id": i.id,
"company_name": i.company_name, "company_name": i.company_name,
......
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