Commit 30650435 authored by 黄奎's avatar 黄奎

页面修改

parent 8639a54a
...@@ -35,7 +35,7 @@ namespace Edu.WebApi.Controllers.User ...@@ -35,7 +35,7 @@ namespace Edu.WebApi.Controllers.User
public FileContentResult DownloadFileForPdf(int configId, string url) public FileContentResult DownloadFileForPdf(int configId, string url)
{ {
DateTime start = DateTime.Now; DateTime start = DateTime.Now;
if (!Directory.Exists("Z:")) if (Common.Config.IsLocal == 0 && !Directory.Exists("Z:"))
{ {
Console.WriteLine("AA___Not:Z:"); Console.WriteLine("AA___Not:Z:");
Common.Plugin.LogHelper.WriteInfo(Common.Plugin.NetFileHelper.WNetAddConnection(@"fast-001\administrator", "Vt@2023..", @"\\172.16.103.126\WebFile", "Z:").ToString()); Common.Plugin.LogHelper.WriteInfo(Common.Plugin.NetFileHelper.WNetAddConnection(@"fast-001\administrator", "Vt@2023..", @"\\172.16.103.126\WebFile", "Z:").ToString());
...@@ -55,6 +55,8 @@ namespace Edu.WebApi.Controllers.User ...@@ -55,6 +55,8 @@ namespace Edu.WebApi.Controllers.User
} }
catch (Exception ex) catch (Exception ex)
{ {
Common.Plugin.LogHelper.Write(ex, "DownloadFileForPdf_Config_" + configId);
Console.WriteLine("DownloadFileForPdf::ex" + ex.Message); Console.WriteLine("DownloadFileForPdf::ex" + ex.Message);
} }
return File(new byte[0], "application/octet-stream"); return File(new byte[0], "application/octet-stream");
...@@ -70,13 +72,20 @@ namespace Edu.WebApi.Controllers.User ...@@ -70,13 +72,20 @@ namespace Edu.WebApi.Controllers.User
url = HttpUtility.UrlDecode(url); url = HttpUtility.UrlDecode(url);
var chromePath = Common.Config.ReadConfigKey("chromePath"); var chromePath = Common.Config.ReadConfigKey("chromePath");
string featurePath = Common.Config.ReadConfigKey("FeaturePath"); string featurePath = Common.Config.ReadConfigKey("FeaturePath");
string IsDownLoadChrome = Common.Config.ReadConfigKey("IsDownLoadChrome");
List<string> argsList = new List<string>(); List<string> argsList = new List<string>();
//是否下载Chrome
if (IsDownLoadChrome == "1")
{
var result = await new BrowserFetcher().DownloadAsync(BrowserFetcher.DefaultChromiumRevision);
}
var browserOptions = new LaunchOptions var browserOptions = new LaunchOptions
{ {
Headless = true, Headless = true,
ExecutablePath = chromePath,
Args = argsList.ToArray(), Args = argsList.ToArray(),
}; };
// ExecutablePath = chromePath,
byte[] pdfBytes = null; byte[] pdfBytes = null;
using (var browser = await Puppeteer.LaunchAsync(browserOptions)) using (var browser = await Puppeteer.LaunchAsync(browserOptions))
{ {
...@@ -89,7 +98,7 @@ namespace Edu.WebApi.Controllers.User ...@@ -89,7 +98,7 @@ namespace Edu.WebApi.Controllers.User
string headerContent = ""; string headerContent = "";
string top = "0px"; string top = "0px";
string bottom = "0px"; string bottom = "0px";
if (System.IO.File.Exists(headerFile)) if (System.IO.File.Exists(headerFile))
{ {
headerContent = string.Format(@"<img src='data:image/png;base64,{0}' style='width:100%;'></img>", ConvertImageToBase64(headerFile)); headerContent = string.Format(@"<img src='data:image/png;base64,{0}' style='width:100%;'></img>", ConvertImageToBase64(headerFile));
......
...@@ -125,8 +125,10 @@ ...@@ -125,8 +125,10 @@
"TeacherAssessmentFlowId": 12, "TeacherAssessmentFlowId": 12,
//不验证学员状态的订单(1382:商务日语听说班【企业课】) //不验证学员状态的订单(1382:商务日语听说班【企业课】)
"NoCheckOrders": "1382", "NoCheckOrders": "1382",
//chrome浏览器地址 //chrome浏览器地址
"chromePath": "C:/Users/Administrator/AppData/Local/Google/Chrome/Application/chrome.exe", "chromePath": "C:/Users/Administrator/AppData/Local/Google/Chrome/Application/chrome.exe",
//行程头部底部图片 //行程头部底部图片
"FeaturePath": "E:\\WebFile\\Feature\\" "FeaturePath": "E:\\WebFile\\Feature\\",
//1-下载Chrome,0-不下载Chrome
"IsDownLoadChrome": "1"
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment