示例#1
0
def game_action():
    if request.method == 'OPTIONS':
        return {}, header_option()
    data = request.json
    check_session(data, request.headers)
    answer = jsonify(Processor().game_action(data))
    return answer, header_option()
示例#2
0
def swipe():
    if request.method == 'OPTIONS':
        return jsonify({}), header_option()
    data = {'id': check_session(request.headers)}
    if request.json:
        data.update(request.json)
    return jsonify(Processor().swipe(data)), header_option()
示例#3
0
def login():
    if request.method == 'OPTIONS':
        print(request.method)
        return jsonify({}), header_option()
    data = request.json
    print(f'data = {data}')
    return jsonify(Processor().login(data)), header_option()
示例#4
0
def login():
    if request.method == 'OPTIONS':
        print(request.method)
        return jsonify({}), header_option()
    data = {'id': check_session(request.headers)}
    if request.json:
        data.update(request.json)
    print(f'data = {data}')
    return jsonify(Processor().login(data)), header_option()
示例#5
0
def profile(id_user):
    if request.method == 'OPTIONS':
        print(request.method)
        return jsonify({}), header_option()
    answer = Processor().profile(id_user)
    if answer:
        answer = answer[0]
    else:
        answer = {}
    return jsonify(answer), header_option()
示例#6
0
def register():
    if request.method == 'OPTIONS':
        return jsonify({}), header_option()
    data = {'id': check_session(request.headers)}
    if request.method == 'GET':
        return jsonify(Processor().get_profile(data)), header_option()
    if request.json:
        data.update(request.json)
    print(f'data = {data}')
    return jsonify(Processor().update_profile(data)), header_option()
示例#7
0
def login():
    if request.method == 'OPTIONS':
        print(request.method)
        return jsonify({}), header_option()
    data = request.json
    print(f'{dumps(data)}')
    if not data:
        return jsonify({}), header_option()
    file = Processor().create_file(data)
    pprint(file)
    return jsonify(file), header_option()
示例#8
0
def game_main():
    answer = {}
    if request.method == 'OPTIONS':
        return {}, header_option()
    elif request.method == 'POST':
        data = request.json
        check_session(data, request.headers)
        answer = Processor().start_game(data)
        answer = Processor().get_game(data.get('id_user'))
    elif request.method == 'GET':
        id_user = session_to_id_user(request.headers)
        answer = Processor().get_game(id_user)
    answer = jsonify(answer)
    return answer, header_option()
示例#9
0
def game_events():
    func = {
        'event': [{
            'element': 'DIV',  # какой элемент изменился
            'description': 'Пользователь заразился CoronaVirus'
        }]
    }
    # answer = jsonify(Processor().profile(id_user))
    answer = jsonify(func)
    return answer, header_option()
示例#10
0
def all_person():
    func = {
        'id_person': 1,
        'name': 'Студент',
        'description': 'Все мы немного студенты и хотим кушать',
        'pic': 'https://emojio.ru/images/apple-b/1f468-200d-1f393.png',
        'health': 10.0,  # Здоровье
        'food': 5.0,  # Питание
        'leisure': 3.0,  # Досуг
        'communication': 4.0,  # Общение
        'value': 3,  # количество денег
    }
    return jsonify(Processor().all_person()), header_option()
示例#11
0
def all_user():
    return jsonify(Processor().users()), header_option()
示例#12
0
def register():
    if request.method == 'OPTIONS':
        return {}, header_option()
    data = request.json
    print(f'data = {data}')
    return jsonify(Processor().create(data)), header_option()
示例#13
0
def all_rating():
    top = Processor().get_top_users()
    func = {'top': top}
    answer = jsonify(func)
    return answer, header_option()
示例#14
0
def test():
    return jsonify(True), header_option()
示例#15
0
def get_meeting():
    if request.method == 'OPTIONS':
        return jsonify({}), header_option()
    data = {'id': check_session(request.headers)}
    return jsonify(Processor().get_meeting(data)), header_option()