Beispiel #1
0
async def update_last_weather_notify(group_id, last_weather_notify):
    session = DBSession()
    try:
        group = session.query(GroupInfo).filter(
            GroupInfo.group_id == group_id).first()
        group.last_weather_notify = last_weather_notify
        session.merge(group)
        session.commit()
    except Exception:
        session.rollback()
    session.close()
Beispiel #2
0
async def get_do_you_know():

    session = DBSession()
    dyn = session.query(DoYouKnow).order_by(func.rand()).first()
    dyn.times += 1
    try:
        session.merge(dyn)
    except Exception:
        session.rollback()
    session.close()
    result = {}
    result['text'] = dyn.text
    result['info'] = dyn.times
    return result