From d440c424c4273050ffa7cdf1475ab4a4729615ff Mon Sep 17 00:00:00 2001 From: xiongziliang <771730766@qq.com> Date: Wed, 13 Nov 2019 14:33:19 +0800 Subject: [PATCH] =?UTF-8?q?=E8=8E=B7=E5=8F=96=E7=BA=BF=E7=A8=8B=E8=B4=9F?= =?UTF-8?q?=E8=BD=BD=E6=8E=A5=E5=8F=A3=E8=BF=94=E5=9B=9Ecode=E5=AD=97?= =?UTF-8?q?=E6=AE=B5=20=E7=AE=80=E5=8C=96=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/WebApi.cpp | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/server/WebApi.cpp b/server/WebApi.cpp index 0f53cd7c..1c7eab29 100644 --- a/server/WebApi.cpp +++ b/server/WebApi.cpp @@ -296,6 +296,7 @@ void installWebApi() { obj["delay"] = vecDelay[i++]; val["data"].append(obj); } + val["code"] = API::Success; invoker("200 OK", headerOut, val.toStyledString()); }); }); @@ -313,6 +314,7 @@ void installWebApi() { obj["delay"] = vecDelay[i++]; val["data"].append(obj); } + val["code"] = API::Success; invoker("200 OK", headerOut, val.toStyledString()); }); }); @@ -393,8 +395,6 @@ void installWebApi() { API_REGIST(api,getMediaList,{ CHECK_SECRET(); //获取所有MediaSource列表 - val["code"] = API::Success; - val["msg"] = "success"; MediaSource::for_each_media([&](const string &schema, const string &vhost, const string &app, @@ -479,13 +479,9 @@ void installWebApi() { //踢掉tcp会话 auto session = SessionMap::Instance().get(allArgs["id"]); if(!session){ - val["code"] = API::OtherFailed; - val["msg"] = "can not find the target"; - return; + throw ApiRetException("can not find the target",API::OtherFailed); } session->safeShutdown(); - val["code"] = API::Success; - val["msg"] = "success"; }); static auto addStreamProxy = [](const string &vhost,