Ejemplo n.º 1
0
def search_by_seller():
    con = db.pool.get_connection()
    cursor = con.cursor()
    try:
        qry_str = dict(request.args)
        msg: str = res_msg.index(200)
        code = 200
        result = []
        if main.is_none(qry_str.get('sellerName')):
            msg = res_msg.index(5)
            code = 463
        else:
            cursor.execute(queries.Query(6), [qry_str.get('sellerName')])
            result = cursor.fetchall()
            result = main.result_dict(cursor.column_names, result)
            msg = res_msg.index(200)
            code = 200
    except BaseException as e:
        msg = e.msg
        code = 500
    finally:
        con.close()
        cursor.close()
        return main.resJson(ResponseCode=code,
                            ResponseMessage=msg,
                            result=result)
Ejemplo n.º 2
0
def display_sellers():
    result = []
    con = db.pool.get_connection()
    code = 200
    msg = res_msg.index(200)
    cursor: Any
    try:
        cursor = con.cursor()
        cursor.execute(queries.Query(0))
        result = cursor.fetchall()
        result = main.result_dict(cursor.column_names, result)
    except db.MySQLError as e:
        code = 500
        msg = e.msg
    finally:
        con.close()
        cursor.close()
        return main.resJson(ResponseCode=code,
                            ResponseMessage=msg,
                            Seller_List=result)
Ejemplo n.º 3
0
def deny_seller():
    con = db.pool.get_connection()
    cursor = con.cursor()
    try:
        body = dict(request.form)
        email = body.get('email')
        id = body.get('merchantID')
        msg = res_msg.index(200)
        code = 200
        if main.is_none(email) or main.is_none(id):
            msg = res_msg.index(5)
            code = 463
        else:
            cursor.execute(queries.Query(4), [id, email])
            con.commit()
    except BaseException as e:
        msg = e.msg
        code = 500
        con.rollback()
    finally:
        con.close()
        cursor.close()
        return main.resJson(ResponseCode=code, ResponseMessage=msg)