Esempio n. 1
0
def export():
    order_id = request.args.get('order_id')
    infra_service = InfraService()

    output = infra_service.export_detail(order_id)

    return send_file(output, as_attachment=True)
Esempio n. 2
0
def add_plan():
    infra_service = InfraService()
    data = urllib.unquote(request.form['data'])

    result = infra_service.add_plan(data)

    return 'hello'
Esempio n. 3
0
def save_order():
    infra_service = InfraService()
    raw_order = request.form['order']

    decoded_order = urllib.unquote(raw_order.__str__())

    order_id = infra_service.save_order(decoded_order)

    host = request.args.get('request_uri')

    result = dict()

    result['url'] = request.host_url + 'export.html?order_id=' + order_id.__str__()
    return json.dumps(result, ensure_ascii=False)
Esempio n. 4
0
def get_details(plan_id):
    infra_service = InfraService()

    request_section = request.args.get('section_id')

    try:
        section_ids = request_section.split(',')
        result = infra_service.get_details(plan_id, section_ids)
    except AttributeError:
        result = dict()
        result['errcode'] = 2
        result['msg'] = 'section_ids is None'

    return json.dumps(result, ensure_ascii=False)
Esempio n. 5
0
def type():
    infra_service = InfraService()
    result = infra_service.get_type()

    return json.dumps(result, ensure_ascii=False)
Esempio n. 6
0
def get_sections(plan_id):
    infra_service = InfraService()

    result = infra_service.get_sections(plan_id)

    return json.dumps(result, ensure_ascii=False)
Esempio n. 7
0
def get_plan():
    type = request.args.get('type').strip()
    infra_service = InfraService()
    summary = infra_service.get_plan_summary(type)
    return json.dumps(summary, ensure_ascii=False)