Exemple #1
0
def post_chat():
    try:
        user = flask_login.current_user.get_id()
        content = flask.request.form['content']
        act_id = flask.request.form['id']
        chat = Chatroom.load_from_db(act_id)
        chat.add_chat(user, content)
        return json.dumps({'status': 'ok'})
    except Exception as e:
        return json.dumps({'status': 'error', 'message': str(e)})
Exemple #2
0
def get_chat():
    try:
        act_id = flask.request.args['id']
        starttime = flask.request.args['starttime']
        return json.dumps({
            'status':
            'ok',
            'message':
            str(Chatroom.load_from_db(act_id).get_chat(starttime))
        })
    except Exception as e:
        return json.dumps({'status': 'error', 'message': str(e)})