diff --git a/QYZH.InteractiveMagazine.WebApi/appsettings.json b/QYZH.InteractiveMagazine.WebApi/appsettings.json index d7f928a..259451a 100644 --- a/QYZH.InteractiveMagazine.WebApi/appsettings.json +++ b/QYZH.InteractiveMagazine.WebApi/appsettings.json @@ -22,8 +22,8 @@ "ClientProvidedName": "Custom connection name" }, "WeChatSettings": { - "AppId": "wx5d8f281c2fd6594c", - "AppSecret": "974f45e4a0aaa075278db0477d0bd8b6" + "AppId": "wx5d8f281c2fd6594c1", + "AppSecret": "974f45e4a0aaa075278db0477d0bd8b61" }, "Serilog": { "MinimumLevel": { diff --git a/QYZH.InteractiveMagazine.WorkService/Consumers/AutoDotCodeConsumer.cs b/QYZH.InteractiveMagazine.WorkService/Consumers/AutoDotCodeConsumer.cs index b867997..819fe15 100644 --- a/QYZH.InteractiveMagazine.WorkService/Consumers/AutoDotCodeConsumer.cs +++ b/QYZH.InteractiveMagazine.WorkService/Consumers/AutoDotCodeConsumer.cs @@ -16,6 +16,7 @@ namespace QYZH.InteractiveMagazine.WorkService.Consumers; /// public class AutoDotCodeConsumer(IConfiguration configuration, IServiceScopeFactory scopeFactory, + IWebHostEnvironment webHostEnvironment, ILogger logger, IHttpClientFactory httpClientFactory, OssService ossService @@ -78,7 +79,7 @@ public class AutoDotCodeConsumer(IConfiguration configuration, #region 调用铺码程序 // 从配置中获取点阵文件Id - var dotId = configuration.GetValue("PrintConfig:DotId", 683790963662917); + var dotId = configuration.GetValue("PrintConfig:DotId", 765837655859269); var dotfile = await dBContext.Queryable().FirstAsync(x => x.Id == dotId, cancellationToken); if (dotfile == null) @@ -87,9 +88,10 @@ public class AutoDotCodeConsumer(IConfiguration configuration, return; } - var exePath = AppDomain.CurrentDomain.BaseDirectory + "PrintToolV2.7\\PrintTool.exe"; + var printToolDirectory = Path.Combine(webHostEnvironment.ContentRootPath, "PrintToolV2.7"); + var exePath = Path.Combine(printToolDirectory, "PrintTool.exe"); - var xmlPath = AppDomain.CurrentDomain.BaseDirectory + $"PrintToolV2.7\\{dotfile.FileName}"; + var xmlPath = Path.Combine(printToolDirectory, dotfile.FileName); #region 注释说明 @@ -151,7 +153,8 @@ public class AutoDotCodeConsumer(IConfiguration configuration, // 从第一个开始执行,连续铺码N条(N为书籍页数) string pageStr = "{" + $"[{dotFileDetailList[0].PageName},{pageNumMax}]" + "}"; - var cmd = $"PrintTool.exe -sMode=Generate -sPDF={uploadFilePath} -sLIC={xmlPath} -pStart=1 -oPDF={downloadFilePath} -dPageAddr=1 -dPrint={dPrint} -dDotSize=40 -dType=0 -dOutFile=0 -dControlPageNum={pageStr}"; + var arguments = $"-sMode=Generate -sPDF=\"{uploadFilePath}\" -sLIC=\"{xmlPath}\" -pStart=1 -oPDF=\"{downloadFilePath}\" -dPageAddr=1 -dPrint={dPrint} -dDotSize=40 -dType=0 -dOutFile=0 -dControlPageNum={pageStr}"; + var cmd = $"\"{exePath}\" {arguments}"; logger.LogInformation($"执行PrintTool.exe 的命令: {cmd}"); @@ -160,9 +163,9 @@ public class AutoDotCodeConsumer(IConfiguration configuration, { p.StartInfo = new ProcessStartInfo { - WorkingDirectory = AppDomain.CurrentDomain.BaseDirectory + "PrintToolV2.7", - FileName = "cmd.exe", - Arguments = "/c " + cmd, // /c参数表示执行后关闭 + WorkingDirectory = printToolDirectory, + FileName = exePath, + Arguments = arguments, UseShellExecute = false, //是否使用操作系统shell启动 RedirectStandardInput = true, //接受来自调用程序的输入信息 RedirectStandardOutput = true, //由调用程序获取输出信息 @@ -336,4 +339,4 @@ internal class CallbackUpdateJournalStatusResponse public bool Result { get; set; } public bool IsSuccess { get; set; } -} \ No newline at end of file +} diff --git a/QYZH.InteractiveMagazine.WorkService/PrintToolV2.7/sublic_license_1761.211.21.48_10000.xml b/QYZH.InteractiveMagazine.WorkService/PrintToolV2.7/sublic_license_1761.211.21.48_10000.xml new file mode 100644 index 0000000..1b75c8c --- /dev/null +++ b/QYZH.InteractiveMagazine.WorkService/PrintToolV2.7/sublic_license_1761.211.21.48_10000.xml @@ -0,0 +1,32 @@ + + + + + + + + + diff --git a/QYZH.InteractiveMagazine.WorkService/appsettings.json b/QYZH.InteractiveMagazine.WorkService/appsettings.json index a50d7b8..80e5596 100644 --- a/QYZH.InteractiveMagazine.WorkService/appsettings.json +++ b/QYZH.InteractiveMagazine.WorkService/appsettings.json @@ -68,6 +68,6 @@ //"CallBackApiUrl": "http://192.168.20.150:8000/api/icr/page/callbackupdatepageno", // 测试环境 打印成功回调API地址修改打印状态 //"CallBackApiUrl": "https://zyb.qyzhjy.com/zybback/api/icr/page/callbackupdatepageno", // 正式环境 打印成功回调API地址修改打印状态 //这个ID执行的xml文件是:sublic_license_1761.172.8.16_1000.xml,如果想执行sublic_license_1761.211.21.48_10000.xml 换成 765837655859269 ---暂时没有导入页码 - "DotId": 683790963662917 + "DotId": 765837655859269 } }