From 1e033e2ca38b4f963fb4ed0a3a48bbef3bfb9024 Mon Sep 17 00:00:00 2001 From: zerlei <1445089819@qq.com> Date: Fri, 11 Oct 2024 16:32:36 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=B7=AE=E4=B8=8D=E5=A4=9A=E6=90=9E?= =?UTF-8?q?=E5=AE=8C=E4=BA=86=EF=BC=8C=E8=BF=98=E6=9C=89=E4=B8=80=E4=B8=AA?= =?UTF-8?q?=E7=AE=80=E5=8D=95=E7=9A=84=E8=84=9A=E6=9C=AC=EF=BC=8C=E8=BF=98?= =?UTF-8?q?=E6=9C=89=E4=B8=80=E4=BA=9B=E6=B5=8B=E8=AF=95=EF=BC=8C=E5=AE=9E?= =?UTF-8?q?=E9=99=85=E7=9A=84=E6=AD=A3=E5=BC=8F=E6=B5=8B=E8=AF=95=EF=BC=8C?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=E9=A3=8E=E6=A0=BC=EF=BC=8C=E6=96=87=E6=A1=A3?= =?UTF-8?q?=E7=AD=89=E7=9A=84=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Server/LocalServer/Program.cs | 3 +++ Server/LocalServer/StateHelper.cs | 7 +++++-- .../Controllers/RemoteServerController.cs | 11 +++++----- Server/ServerTest/PipeSeed.cs | 4 ++-- Server/ServerTest/PipeTest.cs | 4 ++-- Tool/webtool/src/App.vue | 20 +++++++++++++++---- 6 files changed, 33 insertions(+), 16 deletions(-) diff --git a/Server/LocalServer/Program.cs b/Server/LocalServer/Program.cs index 44cae58..e7c007d 100644 --- a/Server/LocalServer/Program.cs +++ b/Server/LocalServer/Program.cs @@ -11,6 +11,9 @@ IConfiguration _configuration = configurationBuilder.Build(); LocalSyncServer.TempRootFile = _configuration["TempDir"] ?? "C:/TempPack"; LocalSyncServer.SqlPackageAbPath = _configuration["SqlPackageAbPath"] ?? "C:\\Users\\ZHAOLEI\\.dotnet\\tools\\sqlpackage.exe"; +LocalSyncServer.MSBuildAbPath = + _configuration["MSBuildAbPath"] + ?? "C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\MSBuild\\Current\\Bin\\amd64\\MSBuild.exe"; //LocalSyncServer.MsdeployAbPath = // _configuration["MsdeployAbPath"] diff --git a/Server/LocalServer/StateHelper.cs b/Server/LocalServer/StateHelper.cs index 01a617e..dd7fc00 100644 --- a/Server/LocalServer/StateHelper.cs +++ b/Server/LocalServer/StateHelper.cs @@ -165,8 +165,8 @@ public class DeployHelper(LocalSyncServer context) FileName = LocalSyncServer.MSBuildAbPath, // The command to execute (can be any command line tool) Arguments = $" {Context.NotNullSyncConfig.LocalProjectAbsolutePath} /t:ResolveReferences" - + $" /t:Compile /p:Configuration=Release /t:_CopyWebApplication /p:OutputPath={LocalSyncServer.TempRootFile}/bin" - + $" /p:WebProjectOutputDir={LocalSyncServer.TempRootFile}", + + $" /t:Compile /p:Configuration=Release /t:_CopyWebApplication /p:OutputPath={Context.NotNullSyncConfig.LocalRootPath}/bin" + + $" /p:WebProjectOutputDir={Context.NotNullSyncConfig.LocalRootPath}", // The arguments to pass to the command (e.g., list directory contents) RedirectStandardOutput = true, // Redirect the standard output to a string RedirectStandardError = true, @@ -187,6 +187,9 @@ public class DeployHelper(LocalSyncServer context) if (bprocess.ExitCode == 0) { Context.LocalPipe.SendMsg(CreateMsg("本地编译成功!")).Wait(); + var h = new DiffFileAndPackHelper(Context); + Context.SetStateHelper(h); + h.DiffProcess(); } else { diff --git a/Server/RemoteServer/Controllers/RemoteServerController.cs b/Server/RemoteServer/Controllers/RemoteServerController.cs index d8a447d..8d3acfa 100644 --- a/Server/RemoteServer/Controllers/RemoteServerController.cs +++ b/Server/RemoteServer/Controllers/RemoteServerController.cs @@ -165,7 +165,7 @@ public class SyncFilesController(RemoteSyncServerFactory factory, SqliteDbContex } [HttpPost("/UploadFile")] - public async Task UploadFile(IFormFile file, [FromQuery] string Id) + public async Task UploadFile(IFormFile file) { try { @@ -173,15 +173,14 @@ public class SyncFilesController(RemoteSyncServerFactory factory, SqliteDbContex { throw new Exception("文件不存在!"); } - var uploadPath = Path.Combine(RemoteSyncServer.TempRootFile, Id); - if (!Directory.Exists(uploadPath)) - Directory.CreateDirectory(uploadPath); - var filePath = Path.Combine(uploadPath, file.FileName); + if (!Directory.Exists(RemoteSyncServer.TempRootFile)) + Directory.CreateDirectory(RemoteSyncServer.TempRootFile); + var filePath = Path.Combine(RemoteSyncServer.TempRootFile, file.FileName); using (var stream = new FileStream(filePath, FileMode.Create)) { await file.CopyToAsync(stream); } - var server = Factory.GetServerById(Id); + var server = Factory.GetServerById(file.FileName.Split('.').First()); if (server == null) { throw new Exception("不存在的Id!"); diff --git a/Server/ServerTest/PipeSeed.cs b/Server/ServerTest/PipeSeed.cs index e9b77a9..fc8125d 100644 --- a/Server/ServerTest/PipeSeed.cs +++ b/Server/ServerTest/PipeSeed.cs @@ -13,8 +13,8 @@ public class PipeSeed : IDisposable Name = "Test", RemoteUrl = "D:/FileSyncTest/dtemp", RemotePwd = "t123", - IsDeployDb = false, - IsDeployProject = false, + IsDeployDb = true, + IsDeployProject = true, LocalProjectAbsolutePath = "D:/git/HMES-H7-HNFY/HMES-H7-HNFYMF/HMES-H7-HNFYMF.WEB", LocalRootPath = "D:/FileSyncTest/src", diff --git a/Server/ServerTest/PipeTest.cs b/Server/ServerTest/PipeTest.cs index 9da6127..cfc4386 100644 --- a/Server/ServerTest/PipeTest.cs +++ b/Server/ServerTest/PipeTest.cs @@ -52,9 +52,9 @@ public class PipeTest RemoteSyncServer.TempRootFile = "D:/FileSyncTest/dtemp"; RemoteSyncServerFactory.NamePwd = [new Tuple("Test", "t123")]; var lf = new LocalSyncServerFactory(); - var task1 = Task.Run(() => + var task1 = Task.Run(async () => { - lf.CreateLocalSyncServer(p2, "Test", p3).RunSynchronously(); + await lf.CreateLocalSyncServer(p2, "Test", p3); }); var rf = new RemoteSyncServerFactory(); diff --git a/Tool/webtool/src/App.vue b/Tool/webtool/src/App.vue index add3d1d..37188d0 100644 --- a/Tool/webtool/src/App.vue +++ b/Tool/webtool/src/App.vue @@ -66,16 +66,15 @@ function publishCB(MsgIt) { if (MsgIt.Body == "发布完成!") { CStatus.value = 'Success' Pipe.ClosePipe() - window.alert("正确:发布完成!") + dialogShow("正确:发布完成!") } } if (MsgIt.Step == 8) { if (CStatus.value != "Success") { - window.alert("失败:请查看错误信息!") + dialogShow("失败:请查看错误信息!") } CStatus.value = "None" } - } function submit() { Msgs.value = [] @@ -93,7 +92,7 @@ function submit() { } catch (e) { - window.alert(e) + dialogShow(e) } } function onLoad(name) { @@ -123,6 +122,15 @@ onMounted(() => { cacheConfig.value = JSON.parse(cacheConfigStr) } }) + +const dMsg = ref('') +function dialogClose() { + document.getElementById('dialog').close() +} +function dialogShow(msg) { + dMsg.value = msg + document.getElementById('dialog').showModal() +}