|
|
|
@ -2353,7 +2353,7 @@ namespace Myshipping.Application
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fileName = $"{order.MBLNO}_{DateTime.Now.Ticks}";//名称
|
|
|
|
|
fileName = $"{order.MBLNO}_{DateTime.Now.Ticks}{fileType}";//名称
|
|
|
|
|
var opt = App.GetOptions<TempFileOptions>().Path;
|
|
|
|
|
var serverpath = Path.Combine(App.WebHostEnvironment.WebRootPath, opt);//服务器路径
|
|
|
|
|
if (!Directory.Exists(serverpath))
|
|
|
|
@ -2633,11 +2633,19 @@ namespace Myshipping.Application
|
|
|
|
|
var fileFullName = Path.Combine(fileFullPath, fn);
|
|
|
|
|
if (File.Exists(fileFullName))
|
|
|
|
|
{
|
|
|
|
|
var readMem = new ReadOnlyMemory<byte>(File.ReadAllBytes(fileFullName));
|
|
|
|
|
_httpContextAccessor.HttpContext.Response.BodyWriter.WriteAsync(readMem);
|
|
|
|
|
_logger.LogInformation($"预览pdf文件:{fileFullName}");
|
|
|
|
|
|
|
|
|
|
var sysConfig = _cache.GetAllSysConfig().Result;
|
|
|
|
|
var viewUrl = sysConfig.FirstOrDefault(x => x.Code == "booking_print_view_pdf_url");
|
|
|
|
|
|
|
|
|
|
//var readMem = new ReadOnlyMemory<byte>(File.ReadAllBytes(fileFullName));
|
|
|
|
|
//_httpContextAccessor.HttpContext.Response.BodyWriter.WriteAsync(readMem);
|
|
|
|
|
_httpContextAccessor.HttpContext.Response.StatusCode = 302;
|
|
|
|
|
_httpContextAccessor.HttpContext.Response.Headers["Location"] = $"{viewUrl.Value}{fn}";
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
_logger.LogInformation($"未找到预览pdf文件:{fileFullName}");
|
|
|
|
|
_httpContextAccessor.HttpContext.Response.StatusCode = 404;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|