Пример #1
0
def collection():
    if request.method == 'POST':
        content = request.get_data(True, as_text=True)
        return admin_service.add_bangumi(content)
    else:
        page = int(request.args.get('page', 1))
        count = int(request.args.get('count', 10))
        sort_field = request.args.get('order_by', 'update_time')
        sort_order = request.args.get('sort', 'desc')
        name = request.args.get('name', None)
        return admin_service.list_bangumi(page, count, sort_field, sort_order, name)
Пример #2
0
def collection():
    if request.method == 'POST':
        content = request.get_data(True, as_text=True)
        return admin_service.add_bangumi(content)
    else:
        page = int(request.args.get('page', 1))
        count = int(request.args.get('count', 10))
        sort_field = request.args.get('order_by', 'update_time')
        sort_order = request.args.get('sort', 'desc')
        name = request.args.get('name', None)
        return admin_service.list_bangumi(page, count, sort_field, sort_order, name)
Пример #3
0
def collection():
    if request.method == 'POST':
        try:
            content = request.get_data(True, as_text=True)
            return admin_service.add_bangumi(content)
        except Exception as exception:
            raise exception
            # resp = make_response(jsonify({'msg': 'error'}), 500)
            # resp.headers['Content-Type'] = 'application/json'
            # return resp
    else:
        page = int(request.args.get('page', 1))
        count = int(request.args.get('count', 10))
        sort_field = request.args.get('order_by', 'update_time')
        sort_order = request.args.get('sort', 'desc')
        name = request.args.get('name', None)
        return admin_service.list_bangumi(page, count, sort_field, sort_order, name)
Пример #4
0
def collection():
    if request.method == 'POST':
        try:
            content = request.get_data(True, as_text=True)
            return admin_service.add_bangumi(content)
        except Exception as exception:
            raise exception
            # resp = make_response(jsonify({'msg': 'error'}), 500)
            # resp.headers['Content-Type'] = 'application/json'
            # return resp
    else:
        page = int(request.args.get('page', 1))
        count = int(request.args.get('count', 10))
        sort_field = request.args.get('order_by', 'update_time')
        sort_order = request.args.get('sort', 'desc')
        name = request.args.get('name', None)
        return admin_service.list_bangumi(page, count, sort_field, sort_order, name)
Пример #5
0
def add_bangumi():
    content = request.get_data(True, as_text=True)
    return admin_service.add_bangumi(content)
Пример #6
0
def add_bangumi():
    content = request.get_data(True, as_text=True)
    return admin_service.add_bangumi(content, current_user.id)