From 7458a67c66a4a01cd2c3c459675f3b075b304fa0 Mon Sep 17 00:00:00 2001 From: ziyue <1213642868@qq.com> Date: Fri, 5 Aug 2022 16:01:31 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3deleteRecordDirectory?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E6=8B=BC=E5=86=99=E9=94=99=E8=AF=AF=E5=B9=B6?= =?UTF-8?q?=E7=B2=BE=E7=AE=80=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- postman/ZLMediaKit.postman_collection.json | 6 +++--- server/WebApi.cpp | 10 ++++------ 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/postman/ZLMediaKit.postman_collection.json b/postman/ZLMediaKit.postman_collection.json index 201a621e..1f1e10cd 100644 --- a/postman/ZLMediaKit.postman_collection.json +++ b/postman/ZLMediaKit.postman_collection.json @@ -946,19 +946,19 @@ "response": [] }, { - "name": "删除录像文件夹(deleteRecordDirectroy)", + "name": "删除录像文件夹(deleteRecordDirectory)", "request": { "method": "GET", "header": [], "url": { - "raw": "{{ZLMediaKit_URL}}/index/api/deleteRecordDirectroy?secret={{ZLMediaKit_secret}}&vhost={{defaultVhost}}&app=proxy&stream=2&period=2020-01-01", + "raw": "{{ZLMediaKit_URL}}/index/api/deleteRecordDirectory?secret={{ZLMediaKit_secret}}&vhost={{defaultVhost}}&app=proxy&stream=2&period=2020-01-01", "host": [ "{{ZLMediaKit_URL}}" ], "path": [ "index", "api", - "deleteRecordDirectroy" + "deleteRecordDirectory" ], "query": [ { diff --git a/server/WebApi.cpp b/server/WebApi.cpp index 29419257..14c6a61c 100755 --- a/server/WebApi.cpp +++ b/server/WebApi.cpp @@ -1335,20 +1335,18 @@ void installWebApi() { // 删除录像文件夹 // http://127.0.0.1/index/api/deleteRecordDirectroy?vhost=__defaultVhost__&app=live&stream=ss&period=2020-01-01 - api_regist("/index/api/deleteRecordDirectroy", [](API_ARGS_MAP) { + api_regist("/index/api/deleteRecordDirectory", [](API_ARGS_MAP) { CHECK_SECRET(); CHECK_ARGS("vhost", "app", "stream"); auto record_path = Recorder::getRecordPath(Recorder::type_mp4, allArgs["vhost"], allArgs["app"], allArgs["stream"], allArgs["customized_path"]); auto period = allArgs["period"]; record_path = record_path + period + "/"; int result = File::delete_file(record_path.data()); - if (result != 0) { + if (result) { + // 不等于0时代表失败 record_path = "delete error"; - val["path"] = record_path; - } else { - val["path"] = record_path.data(); } - + val["path"] = record_path; val["code"] = result; });