Exemplo n.º 1
0
Arquivo: views.py Projeto: LioHub/CW
def check_connect():
    try:
        where = 'telegram = %s' % 12345
        menu = connect_mysql.select('users', where, *['telegram'])
    except Exception as e:
        print('e', e)
        connect_mysql.open()
    return True
Exemplo n.º 2
0
def select_last_street(telegram):
    check_connect()
    water = "'water'"
    where = 'telegram = %s and goods = %s ORDER BY order_number DESC LIMIT 1;' % (
        telegram, water)
    return connect_mysql.select(
        'basket', where, *[
            'order_number', 'telegram', 'name', 'phone', 'goods', 'amount',
            'sum', 'street'
        ])
Exemplo n.º 3
0
Arquivo: views.py Projeto: LioHub/CW
def select_user(telegram):
    check_connect()
    where = 'telegram = %s' % telegram
    return connect_mysql.select('users', where, *['telegram', 'name', 'phone'])
Exemplo n.º 4
0
Arquivo: views.py Projeto: LioHub/CW
def select_menu(telegram):
    check_connect()
    where = 'telegram = %s' % telegram
    return connect_mysql.select('menu', where, *['telegram', 'message_id', 'text', 'index'])
Exemplo n.º 5
0
Arquivo: views.py Projeto: LioHub/CW
def check_user(telegram):
    check_connect()
    where = 'telegram = %s' % telegram
    return connect_mysql.select('users', where, *['telegram'])
Exemplo n.º 6
0
def select_contactID(telegram):
    check_connect()
    where = 'telegram = %s' % telegram
    return connect_mysql.select('users', where,
                                *['contact_id']).get('contact_id')
Exemplo n.º 7
0
def get_message_db(telegram):
    conditional_query = "telegram = %s"
    result = connect_mysql.select("message", conditional_query, *["message_id"], **{'telegram': telegram})
    return result
Exemplo n.º 8
0
def get_branch_db(telegram):
    conditional_query = "telegram = %s"
    result = connect_mysql.select("branches", conditional_query, *["branch"], **{'telegram': telegram})
    return result