示例#1
0
def getdatabyid6(id):
    try:
        client = POOL.connection()
        res_data6 = None
        cursor = client.cursor(cursor=pymysql.cursors.DictCursor)
        sql = sql_user.get('getdatabyid6').format(id=id['id'])
        cursor.execute(sql)
        res_data6 = cursor.fetchone()
        client.commit()
    except Exception as ex:
        client.rollbake()
    finally:
        client.close()
        return res_data6
示例#2
0
def uid(id):
    try:
        client = POOL.connection()
        res_id = None
        cursor = client.cursor(cursor=pymysql.cursors.DictCursor)
        sql = sql_user.get('get_u_id').format(telephone=id['telephone'])
        cursor.execute(sql)
        res_id = cursor.fetchone()
        client.commit()

    except Exception as ex:
        client.rollbake()
    finally:
        client.close()
        return res_id
示例#3
0
def shanchu(id):
    try:
        client = POOL.connection()
        res_id = None
        cursor = client.cursor(cursor=pymysql.cursors.DictCursor)
        sql = sql_user.get('shanchu').format(scenic_id=id['scenic_id'])
        cursor.execute(sql)
        res_id = int(cursor.lastrowid)
        # print(res_id)
        client.commit()

    except Exception as ex:
        client.rollbake()
    finally:
        client.close()
        return res_id
示例#4
0
def into(id):
    try:
        client = POOL.connection()
        res_id = None
        cursor = client.cursor(cursor=pymysql.cursors.DictCursor)
        sql = sql_user.get('into').format(user_id=id['user_id'],
                                          scenic_id=id['scenic_id'])
        cursor.execute(sql)
        res_id = cursor.fetchone()
        # print(res_id)
        client.commit()

    except Exception as ex:
        client.rollbake()
    finally:
        client.close()
        return res_id
示例#5
0
def select_comment(id):
    try:
        client = POOL.connection()
        res_id = None
        cursor = client.cursor(cursor=pymysql.cursors.DictCursor)
        sql = sql_user.get('select_comment').format(scenic_id=id['scenic_id'])
        cursor.execute(sql)
        res_id = cursor.fetchall()
        print(res_id)
        client.commit()

    except Exception as ex:
        client.rollbake()
    finally:
        client.close()
        return res_id


# if __name__ == '__main__':
#     s={"scenic_id":1}
#     select_comment(s)