import requests
from flask import jsonify


def wrap_response(code, msg=None, data=None):
    resp = {"code": code, "msg": msg}
    if code == 200 and not msg:
        resp["msg"] = "success"
    if data:
        resp["data"] = data
    return jsonify(resp)


def quit_human_intervention_status(user_id, staff_id):
    url = f"http://ai-wechat-hook-internal.piaoquantv.com/manage/insertEvent?sender={user_id}&receiver={staff_id}&type=103&content=SYSTEM"
    response = requests.get(url, timeout=20)
    return response.json()
