Commit 1dc8aa7f by Aeolus

update

parent 84b18909
......@@ -174,10 +174,46 @@ def get_business_account_list():
return_data.append({"user_name": info.user_name, "user_id": info.id, "user_no": info.user_no,
"phone": info.phone, "level": info.level, "rate": info.rate
})
super_sql = """ where admin_business.business_id = '{}' and admin_business.status = '1'
and admin_account.status = '1' and admin_account.level < '{}'
""".format(business_id, admin.level)
super_result = db.session.execute(select_sql + from_sql + super_sql).fetchall()
return BaseResponse({"list": return_data, "page": page, "pageSize": page_size,
"total_count": total_count})
@business_route.route("business_super_account_list", methods=["POST"])
def get_business_super_account_list():
"""
:return:
"""
json_data = request.get_json()
page = json_data.get("page", 1)
page_size = json_data.get("pageSize", 10)
business_id = json_data["business_id"]
admin = g.user
if g.user.level != 1:
result = AdminBusiness.query.filter_by(business_id=business_id, user_id=admin.id, status=1).first()
if not result:
return jsonify(ADMIN_BUSINESS_NOT_EXIST)
select_sql = """select admin_account.id, admin_account.user_no,admin_account.user_name, admin_account.phone,
admin_account.level, admin_business.rate """
count_sql = "select count(admin_account.id) as total_count"
from_sql = """ from admin_account left join admin_business on admin_account.id = admin_business.user_id """
where_sql = """ where admin_business.business_id = '{}' and admin_business.status = '1'
and admin_account.status = '1' and admin_account.level < '{}'
""".format(business_id, admin.level)
order_sql = " ORDER BY admin_account.id ASC, admin_account.level ASC"
# limit_sql = " LIMIT {offset} , {page_size} ".format(offset=(page - 1) * page_size, page_size=page_size)
count_result = db.session.execute(count_sql + from_sql + where_sql).fetchone()
if not count_result:
return BaseResponse(data={"list": [], "page": page, "pageSize": page_size, "total_count": 0})
else:
total_count = count_result.total_count
super_result = db.session.execute(select_sql + from_sql + where_sql + order_sql).fetchall()
if not super_result:
return BaseResponse({"list": []})
super_data = [{"user_name": "咻咻科技", "user_id": 0, "user_no": '0', "phone": "0", "level": 1, "rate": 0}]
for info in super_result:
if info.level in (1, 3):
......@@ -186,8 +222,7 @@ def get_business_account_list():
super_data.append({"user_name": info.user_name, "user_id": info.id, "user_no": info.user_no,
"phone": info.phone, "level": info.level, "rate": info.rate
})
return BaseResponse({"super_list": super_data, "list": return_data, "page": page, "pageSize": page_size,
"total_count": total_count})
return BaseResponse({"list": super_data})
@business_route.route("edit_admin_account", methods=["POST"])
......
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