From b7041949338728f4f8b7cc96f4ed6a92b40fda36 Mon Sep 17 00:00:00 2001
From: yl <ykxkd@outlook.com>
Date: 星期五, 05 一月 2024 12:30:56 +0800
Subject: [PATCH] 1.Startup.cs 文件中增加授权.apk文件 2.Excel下载方法中增加.net core直接下载wwwroot下的文件代码(暂时不用,先注释掉)
---
VueWebCoreApi/Controllers/ImportExcelController.cs | 36 +++++++++++++++++++++++++++++++++++-
1 files changed, 35 insertions(+), 1 deletions(-)
diff --git a/VueWebCoreApi/Controllers/ImportExcelController.cs b/VueWebCoreApi/Controllers/ImportExcelController.cs
index e2ef326..e6de79f 100644
--- a/VueWebCoreApi/Controllers/ImportExcelController.cs
+++ b/VueWebCoreApi/Controllers/ImportExcelController.cs
@@ -1,4 +1,5 @@
-锘縰sing Microsoft.AspNetCore.Mvc;
+锘縰sing Microsoft.AspNetCore.Hosting;
+using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Data;
@@ -18,6 +19,12 @@
//[ChannelActionFilter]
public class ImportExcelController : Controller
{
+ private readonly IWebHostEnvironment _hostingEnvironment;
+
+ public ImportExcelController(IWebHostEnvironment hostingEnvironment)
+ {
+ _hostingEnvironment = hostingEnvironment;
+ }
#region[Excel瀵煎叆妯℃澘鍒楄〃]
/// <summary>
@@ -55,6 +62,33 @@
mes.code = "200";
mes.data = msg;
return Json(mes);
+
+ //ToMessage mes = new ToMessage();
+ //List<ScoreReport> list = ExcelList.ExcelData();
+ //list = list.Where(s => s.FileCode == FileCode).ToList();
+ //var filename = list[0].FileName + ".xls";
+ //var wwwRootPath = _hostingEnvironment.WebRootPath;
+ //var fileDirectory = Path.Combine(wwwRootPath, "Excel"); // 鏇挎崲涓烘偍鐨凟xcel鏂囦欢鎵�鍦ㄧ洰褰�
+ //var filePath = Path.Combine(fileDirectory, $"{filename}.xlsx"); // 鍋囪鏂囦欢鍚嶇紪鐮佷负鏂囦欢鍚�
+
+ //if (System.IO.File.Exists(filePath))
+ //{
+ // var fileInfo = new FileInfo(filePath);
+ // var result = new
+ // {
+ // FileName = fileInfo.Name,
+ // FilePath = filePath,
+ // FileSize = fileInfo.Length
+ // };
+ // return Json(result);
+ //}
+ //else
+ //{
+ // mes.code = "300";
+ // mes.data = "";
+ // mes.message = "鏂囦欢涓嶅瓨鍦�";
+ //}
+ //return Json(mes);
}
#endregion
--
Gitblit v1.9.3