示例#1
0
def update_strategy():
    handler = ApiPortal()
    rep_data = json.loads(request.data)
    sid = rep_data["sid"].strip()
    metric = rep_data["metric"].strip()
    op = rep_data["op"].strip()
    right_value = rep_data["right_value"].strip()
    if not handler.api_get_strategy(sid):
        abort(404)
    if not handler.api_update_strategy(sid, metric, op, right_value):
        abort(500)
    data = handler.api_get_strategy(sid)
    return  jsonify(msg="success",data=data,action="update"),200
示例#2
0
def delete_strategy(sid):
    handler = ApiPortal()
    data = handler.api_get_strategy(sid)
    if not data:
        abort(404)
    rep = handler.api_delete_strategy(sid)
    if not rep:
        abort(500)
    return jsonify(msg="success",data=data,action="delete"),200
示例#3
0
def get_strategy(sid):
    handler = ApiPortal()
    data = handler.api_get_strategy(sid)
    if not data:
        abort(404)
    return  jsonify(msg="success",data=data),200