Commit 039c6979 by Aeolus

update

parent d5f61abd
...@@ -24,7 +24,7 @@ class Config: ...@@ -24,7 +24,7 @@ class Config:
JWT_SECRET = SECRET_KEY JWT_SECRET = SECRET_KEY
TENCENT_REDIS_URL = os.getenv("TENCENT_REDIS_URL") TENCENT_REDIS_URL = os.getenv("TENCENT_REDIS_URL")
MAX_CONTENT_LENGTH = 16 * 1024 * 1024 MAX_CONTENT_LENGTH = 16 * 1024 * 1024
SQLALCHEMY_ECHO = True # SQLALCHEMY_ECHO = True
@staticmethod @staticmethod
def init_app(app): def init_app(app):
......
...@@ -192,11 +192,15 @@ def get_machine_detail(): ...@@ -192,11 +192,15 @@ def get_machine_detail():
from_sql = """ from machine from_sql = """ from machine
left join place on machine.place_id = place.id left join place on machine.place_id = place.id
left join business on machine.business_id = business.id left join business on machine.business_id = business.id
where machine.machine_no in ( select machine_no from admin_machine where """
admin_machine.user_id = {user_id} and admin_machine.status = 1)
""".format(user_id=admin.id)
where_sql = " and machine.machine_no = {}".format(machine_no) if g.user.level == 1:
where_sql = " where 0=0 "
else:
where_sql = """ where machine.machine_no in ( select machine_no from admin_machine where
admin_machine.user_id = {user_id} and admin_machine.status = 1) """.format(user_id=admin.id)
where_sql += " and machine.machine_no = {}".format(machine_no)
result = db.session.execute(select_sql + from_sql + where_sql).fetchall() result = db.session.execute(select_sql + from_sql + where_sql).fetchall()
if not result or len(result) != 1: if not result or len(result) != 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