From 2e7af753daec28ae5de42ca8fa6265605138034a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E6=BD=87=E9=98=B3?= Date: Sat, 1 Jul 2023 23:33:38 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=B8=80=E4=B8=AA=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E4=B8=8B=E8=BD=BD=E6=8E=A5=E5=8F=A3=EF=BC=8C=E4=B8=8B?= =?UTF-8?q?=E8=BD=BD=E8=A7=86=E9=A2=91=E4=B8=BE=E6=8A=A5=E7=9A=84=E6=96=87?= =?UTF-8?q?=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 3 ++- 24Hour/Controllers/LoginController.cs | 22 ++++++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 82b557f..33679dd 100644 --- a/.gitignore +++ b/.gitignore @@ -42,6 +42,7 @@ *.su *.idb *.pdb +*.mp4 # Kernel Module Compile Results *.mod* @@ -69,4 +70,4 @@ dkms.conf /24Hour/wwwroot/CaseFile/Detectionscheme/20230301194942291.docx /24Hour/wwwroot/CaseFile/Detectionscheme/20230301193901426.docx /24Hour/24Hour.xml -/24Hour/Properties/launchSettings.json +/24Hour/Properties/launchSettings.json diff --git a/24Hour/Controllers/LoginController.cs b/24Hour/Controllers/LoginController.cs index dbba9af..3082422 100644 --- a/24Hour/Controllers/LoginController.cs +++ b/24Hour/Controllers/LoginController.cs @@ -453,9 +453,31 @@ namespace _24Hour.Controllers } } return ret; + } + + /// + /// download file for video repot module + /// + /// + [HttpGet, AllowAnonymous] + [Route("download")] + public IActionResult DownloadFile(string filepath) + { + var fileaddr = Path.Combine(Environment.CurrentDirectory,"wwwroot"); + fileaddr += filepath; + if (System.IO.File.Exists(fileaddr) == false) + { + return new BadRequestResult(); + } + return new FileStreamResult(new FileStream(path: fileaddr, FileMode.Open), "application/octet-stream") + { + FileDownloadName = Path.GetFileName(fileaddr), + }; } } + + public class UserLogin { [DataMember]