1.Startup.cs 文件中增加授权.apk文件
2.Excel下载方法中增加.net core直接下载wwwroot下的文件代码(暂时不用,先注释掉)
已修改5个文件
65 ■■■■ 文件已修改
VueWebCoreApi/Controllers/ImportExcelController.cs 36 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
VueWebCoreApi/DLL/DAL/BasicSettingDAL.cs 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
VueWebCoreApi/Startup.cs 11 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
VueWebCoreApi/Tools/ExcelList.cs 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
VueWebCoreApi/appsettings.json 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
VueWebCoreApi/Controllers/ImportExcelController.cs
@@ -1,4 +1,5 @@
using Microsoft.AspNetCore.Mvc;
using 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"); // 替换为您的Excel文件所在目录
            //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
VueWebCoreApi/DLL/DAL/BasicSettingDAL.cs
@@ -3039,6 +3039,14 @@
            IEnumerable<object> data;
            try
            {
                if (flag == "-1" && stckcode == null)
                {
                    mes.code = "200";
                    mes.count = 0;
                    mes.message = "暂无数据!";
                    mes.data = null;
                    return mes;
                }
                string[] classcode = Array.ConvertAll<string, string>(stckcode.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries), s => s.ToString()); //string分割转string[]
                switch (flag)
                {
VueWebCoreApi/Startup.cs
@@ -157,11 +157,12 @@
            //添加静态文件中间件
            app.UseDefaultFiles();
            //添加授权文件
            app.UseStaticFiles(new StaticFileOptions()
            {
                ContentTypeProvider = new FileExtensionContentTypeProvider()
                {
                    Mappings = { [".xls"] = "application/vnd.ms-excel" }
            app.UseStaticFiles(new StaticFileOptions() {
                ContentTypeProvider = new FileExtensionContentTypeProvider() {
                    Mappings = {
                        [".xls"] = "application/vnd.ms-excel",
                        [".apk"] = "application/vnd.android.package-archive"
                    }
                }
            });
            app.UseStaticFiles();
VueWebCoreApi/Tools/ExcelList.cs
@@ -22,10 +22,10 @@
                //new ScoreReport("7","库位设置"),
                new ScoreReport("8","存货档案"),
                new ScoreReport("9","设备清单"),
                new ScoreReport("10","设备点检项目"),
                new ScoreReport("10_1","设备点检标准"),
                new ScoreReport("11","设备保养项目"),
                new ScoreReport("11_1","设备保养标准"),
                //new ScoreReport("10","设备点检项目"),
                //new ScoreReport("10_1","设备点检标准"),
                //new ScoreReport("11","设备保养项目"),
                //new ScoreReport("11_1","设备保养标准"),
                new ScoreReport("12","模具清单"),
                new ScoreReport("13","模具点检项目"),
                new ScoreReport("13_1","模具点检标准"),
VueWebCoreApi/appsettings.json
@@ -25,7 +25,7 @@
    //session失效时间
    "InProc": "240",
    //Excel导出模板配置IP
    "FileIP": "http://121.196.36.24:8025/",
    "FileIP": "http://121.196.36.24:8021/",
    //jwtkey
    "SigningKey": "Hello World"
  }