Test.EIImageViewer
hang 2023-04-17 08:51:21 +08:00
parent 0c2951c96b
commit 94dc00ddec
6 changed files with 128 additions and 158 deletions

View File

@ -1,39 +0,0 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
}
},
//"RootUrl": "http://123.56.181.144:8060/",
"ConnectionStrings": {
"RemoteNew": "Server=101.132.193.237,1433;Database=IRaCIS.Production;User ID=sa;Password=zhanying2021;TrustServerCertificate=true",
"Hangfire": "Server=101.132.193.237,1433;Database=Hangfire.IRaCIS.Production;User ID=sa;Password=zhanying2021;TrustServerCertificate=true"
},
"BasicSystemConfig": {
"OpenUserComplexPassword": true,
"OpenSignDocumentBeforeWork": true,
"OpenLoginLimit": true
},
//"SystemEmailSendConfig": {
// "Port": 465,
// "Host": "smtp.163.com",
// "FromEmail": "zhou941003@qq.com",
// "FromName": "hangZhou",
// "AuthorizationCode": "sqfhlpfdvnexbcab"
//}
"SystemEmailSendConfig": {
"Port": 465,
"Host": "smtp.qiye.aliyun.com",
"FromEmail": "IRC@extimaging.com",
"FromName": "IRC",
"AuthorizationCode": "ExtImg@2022"
}
}

View File

@ -541,10 +541,12 @@ namespace IRaCIS.Application.Services
_mapper.Map(model, user); _mapper.Map(model, user);
if (user.IsZhiZhun) //if (user.IsZhiZhun)
{ //{
user.OrganizationName = AppSettings.DefaultInternalOrganizationName; // user.OrganizationName = AppSettings.DefaultInternalOrganizationName;
} //}
var success = await _userRepository.SaveChangesAsync(); var success = await _userRepository.SaveChangesAsync();
return ResponseOutput.Ok(success); return ResponseOutput.Ok(success);

71
Start/Main.Designer.cs generated
View File

@ -37,6 +37,7 @@
label2 = new Label(); label2 = new Label();
label1 = new Label(); label1 = new Label();
groupBox2 = new GroupBox(); groupBox2 = new GroupBox();
confimDeployBtn = new Button();
testDBBtn = new Button(); testDBBtn = new Button();
testServicebtn = new Button(); testServicebtn = new Button();
serviceDisplayNameTBox = new TextBox(); serviceDisplayNameTBox = new TextBox();
@ -63,7 +64,6 @@
groupBox4 = new GroupBox(); groupBox4 = new GroupBox();
logTBox = new RichTextBox(); logTBox = new RichTextBox();
folderBrowserDialog1 = new FolderBrowserDialog(); folderBrowserDialog1 = new FolderBrowserDialog();
confimDeployBtn = new Button();
groupBox1.SuspendLayout(); groupBox1.SuspendLayout();
groupBox2.SuspendLayout(); groupBox2.SuspendLayout();
groupBox3.SuspendLayout(); groupBox3.SuspendLayout();
@ -173,9 +173,21 @@
groupBox2.TabStop = false; groupBox2.TabStop = false;
groupBox2.Text = "第二步: 部署配置"; groupBox2.Text = "第二步: 部署配置";
// //
// confimDeployBtn
//
confimDeployBtn.Enabled = false;
confimDeployBtn.Location = new Point(220, 369);
confimDeployBtn.Name = "confimDeployBtn";
confimDeployBtn.Size = new Size(128, 49);
confimDeployBtn.TabIndex = 19;
confimDeployBtn.Text = "确认部署配置";
confimDeployBtn.UseVisualStyleBackColor = true;
confimDeployBtn.Click += confimDeployBtn_Click;
//
// testDBBtn // testDBBtn
// //
testDBBtn.Location = new Point(423, 191); testDBBtn.Enabled = false;
testDBBtn.Location = new Point(417, 196);
testDBBtn.Name = "testDBBtn"; testDBBtn.Name = "testDBBtn";
testDBBtn.Size = new Size(128, 49); testDBBtn.Size = new Size(128, 49);
testDBBtn.TabIndex = 18; testDBBtn.TabIndex = 18;
@ -185,7 +197,8 @@
// //
// testServicebtn // testServicebtn
// //
testServicebtn.Location = new Point(418, 271); testServicebtn.Enabled = false;
testServicebtn.Location = new Point(417, 276);
testServicebtn.Name = "testServicebtn"; testServicebtn.Name = "testServicebtn";
testServicebtn.Size = new Size(128, 49); testServicebtn.Size = new Size(128, 49);
testServicebtn.TabIndex = 17; testServicebtn.TabIndex = 17;
@ -195,7 +208,7 @@
// //
// serviceDisplayNameTBox // serviceDisplayNameTBox
// //
serviceDisplayNameTBox.Location = new Point(198, 303); serviceDisplayNameTBox.Location = new Point(197, 308);
serviceDisplayNameTBox.Name = "serviceDisplayNameTBox"; serviceDisplayNameTBox.Name = "serviceDisplayNameTBox";
serviceDisplayNameTBox.Size = new Size(197, 23); serviceDisplayNameTBox.Size = new Size(197, 23);
serviceDisplayNameTBox.TabIndex = 16; serviceDisplayNameTBox.TabIndex = 16;
@ -203,7 +216,7 @@
// //
// serviceNameTBox // serviceNameTBox
// //
serviceNameTBox.Location = new Point(198, 246); serviceNameTBox.Location = new Point(197, 251);
serviceNameTBox.Name = "serviceNameTBox"; serviceNameTBox.Name = "serviceNameTBox";
serviceNameTBox.Size = new Size(197, 23); serviceNameTBox.Size = new Size(197, 23);
serviceNameTBox.TabIndex = 15; serviceNameTBox.TabIndex = 15;
@ -212,7 +225,7 @@
// label11 // label11
// //
label11.AutoSize = true; label11.AutoSize = true;
label11.Location = new Point(21, 303); label11.Location = new Point(20, 308);
label11.Name = "label11"; label11.Name = "label11";
label11.Size = new Size(128, 17); label11.Size = new Size(128, 17);
label11.TabIndex = 14; label11.TabIndex = 14;
@ -221,7 +234,7 @@
// label10 // label10
// //
label10.AutoSize = true; label10.AutoSize = true;
label10.Location = new Point(21, 249); label10.Location = new Point(20, 254);
label10.Name = "label10"; label10.Name = "label10";
label10.Size = new Size(104, 17); label10.Size = new Size(104, 17);
label10.TabIndex = 13; label10.TabIndex = 13;
@ -229,7 +242,8 @@
// //
// selectPathBtn // selectPathBtn
// //
selectPathBtn.Location = new Point(418, 39); selectPathBtn.Enabled = false;
selectPathBtn.Location = new Point(417, 44);
selectPathBtn.Name = "selectPathBtn"; selectPathBtn.Name = "selectPathBtn";
selectPathBtn.Size = new Size(128, 31); selectPathBtn.Size = new Size(128, 31);
selectPathBtn.TabIndex = 12; selectPathBtn.TabIndex = 12;
@ -240,7 +254,7 @@
// folderPathTbox // folderPathTbox
// //
folderPathTbox.Enabled = false; folderPathTbox.Enabled = false;
folderPathTbox.Location = new Point(120, 43); folderPathTbox.Location = new Point(119, 48);
folderPathTbox.Name = "folderPathTbox"; folderPathTbox.Name = "folderPathTbox";
folderPathTbox.Size = new Size(271, 23); folderPathTbox.Size = new Size(271, 23);
folderPathTbox.TabIndex = 11; folderPathTbox.TabIndex = 11;
@ -248,7 +262,7 @@
// label9 // label9
// //
label9.AutoSize = true; label9.AutoSize = true;
label9.Location = new Point(21, 46); label9.Location = new Point(20, 51);
label9.Name = "label9"; label9.Name = "label9";
label9.Size = new Size(92, 17); label9.Size = new Size(92, 17);
label9.TabIndex = 10; label9.TabIndex = 10;
@ -256,7 +270,7 @@
// //
// dbNameTBox // dbNameTBox
// //
dbNameTBox.Location = new Point(199, 191); dbNameTBox.Location = new Point(198, 196);
dbNameTBox.Name = "dbNameTBox"; dbNameTBox.Name = "dbNameTBox";
dbNameTBox.Size = new Size(197, 23); dbNameTBox.Size = new Size(197, 23);
dbNameTBox.TabIndex = 9; dbNameTBox.TabIndex = 9;
@ -265,7 +279,7 @@
// label8 // label8
// //
label8.AutoSize = true; label8.AutoSize = true;
label8.Location = new Point(21, 196); label8.Location = new Point(20, 201);
label8.Name = "label8"; label8.Name = "label8";
label8.Size = new Size(92, 17); label8.Size = new Size(92, 17);
label8.TabIndex = 8; label8.TabIndex = 8;
@ -273,7 +287,8 @@
// //
// portBtn // portBtn
// //
portBtn.Location = new Point(423, 109); portBtn.Enabled = false;
portBtn.Location = new Point(417, 114);
portBtn.Name = "portBtn"; portBtn.Name = "portBtn";
portBtn.Size = new Size(128, 49); portBtn.Size = new Size(128, 49);
portBtn.TabIndex = 7; portBtn.TabIndex = 7;
@ -283,7 +298,7 @@
// //
// apiPortTBox // apiPortTBox
// //
apiPortTBox.Location = new Point(199, 146); apiPortTBox.Location = new Point(198, 151);
apiPortTBox.Name = "apiPortTBox"; apiPortTBox.Name = "apiPortTBox";
apiPortTBox.Size = new Size(197, 23); apiPortTBox.Size = new Size(197, 23);
apiPortTBox.TabIndex = 5; apiPortTBox.TabIndex = 5;
@ -291,7 +306,7 @@
// //
// nginxPortTBox // nginxPortTBox
// //
nginxPortTBox.Location = new Point(198, 98); nginxPortTBox.Location = new Point(197, 103);
nginxPortTBox.Name = "nginxPortTBox"; nginxPortTBox.Name = "nginxPortTBox";
nginxPortTBox.Size = new Size(197, 23); nginxPortTBox.Size = new Size(197, 23);
nginxPortTBox.TabIndex = 4; nginxPortTBox.TabIndex = 4;
@ -300,7 +315,7 @@
// label4 // label4
// //
label4.AutoSize = true; label4.AutoSize = true;
label4.Location = new Point(21, 152); label4.Location = new Point(20, 157);
label4.Name = "label4"; label4.Name = "label4";
label4.Size = new Size(128, 17); label4.Size = new Size(128, 17);
label4.TabIndex = 3; label4.TabIndex = 3;
@ -309,7 +324,7 @@
// label5 // label5
// //
label5.AutoSize = true; label5.AutoSize = true;
label5.Location = new Point(21, 102); label5.Location = new Point(20, 107);
label5.Name = "label5"; label5.Name = "label5";
label5.Size = new Size(104, 17); label5.Size = new Size(104, 17);
label5.TabIndex = 2; label5.TabIndex = 2;
@ -332,6 +347,7 @@
// //
// activeBtn // activeBtn
// //
activeBtn.Enabled = false;
activeBtn.Location = new Point(430, 69); activeBtn.Location = new Point(430, 69);
activeBtn.Name = "activeBtn"; activeBtn.Name = "activeBtn";
activeBtn.Size = new Size(128, 49); activeBtn.Size = new Size(128, 49);
@ -385,31 +401,21 @@
// groupBox4 // groupBox4
// //
groupBox4.Controls.Add(logTBox); groupBox4.Controls.Add(logTBox);
groupBox4.Location = new Point(618, 32); groupBox4.Location = new Point(618, 25);
groupBox4.Name = "groupBox4"; groupBox4.Name = "groupBox4";
groupBox4.Size = new Size(391, 791); groupBox4.Size = new Size(391, 851);
groupBox4.TabIndex = 4; groupBox4.TabIndex = 4;
groupBox4.TabStop = false; groupBox4.TabStop = false;
groupBox4.Text = "运行日志"; groupBox4.Text = "部署提示日志";
// //
// logTBox // logTBox
// //
logTBox.Location = new Point(6, 35); logTBox.Location = new Point(6, 22);
logTBox.Name = "logTBox"; logTBox.Name = "logTBox";
logTBox.Size = new Size(359, 738); logTBox.Size = new Size(359, 816);
logTBox.TabIndex = 0; logTBox.TabIndex = 0;
logTBox.Text = ""; logTBox.Text = "";
// //
// confimDeployBtn
//
confimDeployBtn.Location = new Point(198, 370);
confimDeployBtn.Name = "confimDeployBtn";
confimDeployBtn.Size = new Size(128, 49);
confimDeployBtn.TabIndex = 19;
confimDeployBtn.Text = "确认部署配置";
confimDeployBtn.UseVisualStyleBackColor = true;
confimDeployBtn.Click += confimDeployBtn_Click;
//
// Main // Main
// //
AutoScaleDimensions = new SizeF(7F, 17F); AutoScaleDimensions = new SizeF(7F, 17F);
@ -421,7 +427,6 @@
Controls.Add(groupBox1); Controls.Add(groupBox1);
Name = "Main"; Name = "Main";
Text = "EI Image Viewer"; Text = "EI Image Viewer";
Load += Main_Load;
groupBox1.ResumeLayout(false); groupBox1.ResumeLayout(false);
groupBox1.PerformLayout(); groupBox1.PerformLayout();
groupBox2.ResumeLayout(false); groupBox2.ResumeLayout(false);

View File

@ -35,9 +35,9 @@ namespace Start
private bool isPortTestOk = false; private bool isPortTestOk = false;
private bool isServiceTestOk=false; private bool isServiceTestOk = false;
private bool isDBNameTestOK=false; private bool isDBNameTestOK = false;
public Main() public Main()
{ {
@ -50,34 +50,6 @@ namespace Start
this.KeySecreteTextBox.Text = Md5($"{this.machineTextBox.Text}_XINGCANG"); this.KeySecreteTextBox.Text = Md5($"{this.machineTextBox.Text}_XINGCANG");
} }
private void Main_Load(object sender, EventArgs e)
{
portBtn.Enabled = false;
activeBtn.Enabled = false;
//serverTextBox.DataBindings.Add(new Binding("Enabled", this, "isCanDBConfig"));
//usernameTextBox.DataBindings.Add(new Binding("Enabled", this, "isCanDBConfig"));
//passwordTextBox.DataBindings.Add(new Binding("Enabled", this, "isCanDBConfig"));
//nginxPortTBox.DataBindings.Add(new Binding("Enabled", this, "isCanServerConfig"));
//apiPortTBox.DataBindings.Add(new Binding("Enabled", this, "isCanServerConfig"));
//dbNameTBox.DataBindings.Add(new Binding("Enabled", this, "isCanServerConfig"));
//connectButton.DataBindings.Add(new Binding("Enabled", this, "isCanDBConfig"));
}
int apiPort = 7100; int apiPort = 7100;
int vuePort = 9527; int vuePort = 9527;
private void connectButton_Click(object sender, EventArgs e) private void connectButton_Click(object sender, EventArgs e)
@ -89,7 +61,7 @@ namespace Start
{ {
connection.Open(); connection.Open();
Log("数据库连接成功!", Color.Green); Log("数据库连接测试成功!", Color.Green);
isCanDBConfig = false; isCanDBConfig = false;
serverTextBox.Enabled = isCanDBConfig; serverTextBox.Enabled = isCanDBConfig;
@ -97,13 +69,18 @@ namespace Start
passwordTextBox.Enabled = isCanDBConfig; passwordTextBox.Enabled = isCanDBConfig;
connectButton.Enabled = false; connectButton.Enabled = false;
selectPathBtn.Enabled = true;
portBtn.Enabled = true; portBtn.Enabled = true;
testDBBtn.Enabled = true;
testServicebtn.Enabled = true;
confimDeployBtn.Enabled = true;
} }
catch (Exception ex) catch (Exception ex)
{ {
Log($"数据库连接失败:{ex.Message}", Color.Red); Log($"数据库连接测试失败:{ex.Message}", Color.Red);
} }
finally finally
@ -114,39 +91,6 @@ namespace Start
private async void portBtn_Click(object sender, EventArgs e) private async void portBtn_Click(object sender, EventArgs e)
{ {
#region 测试 停止Nginx
string nginxPath = Path.Combine(AppContext.BaseDirectory, @$"deploy\nginx-1.20.1\");
var serviceConfig = await File.ReadAllTextAsync("deploy/ServiceConfig.json");
var jObject = JObject.Parse(serviceConfig);
#region 创建进程执行命令
Process process = new Process();
process.StartInfo.FileName = "cmd.exe";
process.StartInfo.RedirectStandardInput = true;
process.StartInfo.UseShellExecute = false;
process.StartInfo.CreateNoWindow = true; // 不创建新窗口
process.Start();
var proList = Process.GetProcesses().Where(t => t.ProcessName.Contains("nginx") && t.MainModule.FileName.Contains(nginxPath));
foreach (var item in proList)
{
item.Kill();
}
await ProcessStandardInputAsync(process, $"sc stop {jObject["serviceName"].ToString()}");
process.StandardInput.Close();
process.WaitForExit();
#endregion
#endregion
if (int.TryParse(nginxPortTBox.Text, out vuePort) == false || int.TryParse(apiPortTBox.Text, out apiPort) == false) if (int.TryParse(nginxPortTBox.Text, out vuePort) == false || int.TryParse(apiPortTBox.Text, out apiPort) == false)
{ {
@ -187,7 +131,7 @@ namespace Start
return; return;
} }
Log($"测试服务名称成功", Color.Green);
isServiceTestOk = true; isServiceTestOk = true;
} }
@ -224,9 +168,10 @@ namespace Start
} }
Log($"数据库名称测试成功", Color.Green);
isDBNameTestOK = true; isDBNameTestOK = true;
} }
@ -234,13 +179,29 @@ namespace Start
private void confimDeployBtn_Click(object sender, EventArgs e) private void confimDeployBtn_Click(object sender, EventArgs e)
{ {
if (string.IsNullOrWhiteSpace(this.folderPathTbox.Text) || isDBNameTestOK == false || isPortTestOk == false || isServiceTestOk == false)
{
Log($"请选择部署路径,并分别测试端口,数据库名,服务名都成功才可以进行确认", Color.Red);
return;
}
Log($"部署配置确认成功", Color.Green);
activeBtn.Enabled = true; activeBtn.Enabled = true;
confimDeployBtn.Enabled = false;
portBtn.Enabled = false;
selectPathBtn.Enabled = false;
testDBBtn.Enabled = false;
testServicebtn.Enabled = false;
nginxPortTBox.Enabled = false; nginxPortTBox.Enabled = false;
apiPortTBox.Enabled = false; apiPortTBox.Enabled = false;
portBtn.Enabled = false;
dbNameTBox.Enabled = false; dbNameTBox.Enabled = false;
serviceNameTBox.Enabled = false;
serviceDisplayNameTBox.Enabled = false;
} }
private static bool IsPortInUse(int port) private static bool IsPortInUse(int port)
@ -296,6 +257,13 @@ namespace Start
private async void activeBtn_Click(object sender, EventArgs e) private async void activeBtn_Click(object sender, EventArgs e)
{ {
if (Md5($"{machineTextBox.Text}_XINGCANG") != KeySecreteTextBox.Text.Trim())
{
Log($"秘钥不正确,请联系供应商", Color.Red);
return;
}
this.activeBtn.Enabled = false; this.activeBtn.Enabled = false;
@ -326,7 +294,7 @@ namespace Start
startInfo.FileName = "cmd.exe"; // 指定要启动的应用程序 startInfo.FileName = "cmd.exe"; // 指定要启动的应用程序
startInfo.RedirectStandardInput = true; startInfo.RedirectStandardInput = true;
startInfo.UseShellExecute = false; startInfo.UseShellExecute = false;
//startInfo.CreateNoWindow = true; startInfo.CreateNoWindow = true;
// 创建新进程并启动 // 创建新进程并启动
var process = new Process(); var process = new Process();
@ -487,9 +455,9 @@ namespace Start
// 删除已存在的服务 // 删除已存在的服务
await ProcessStandardInputAsync(process, $"sc delete {serviceName}"); //await ProcessStandardInputAsync(process, $"sc delete {serviceName}");
Log($"删除服务{serviceName}...", Color.Green); //Log($"删除服务{serviceName}...", Color.Green);
// 执行 sc create 命令来创建服务 // 执行 sc create 命令来创建服务
await ProcessStandardInputAsync(process, createStr); await ProcessStandardInputAsync(process, createStr);
@ -522,8 +490,12 @@ namespace Start
{ {
Log($"后端服务启动成功", Color.Green); Log($"后端服务启动成功", Color.Green);
Log($"部署工作已完成", Color.Green);
try try
{ {
Log($"现在打开浏览器...", Color.Green);
// Use ProcessStartInfo class // Use ProcessStartInfo class
var start = new ProcessStartInfo($"http://127.0.0.1:{vuePort}") var start = new ProcessStartInfo($"http://127.0.0.1:{vuePort}")
{ {
@ -551,15 +523,53 @@ namespace Start
#endregion #endregion
} }
private void selectPathBtn_Click(object sender, EventArgs e) private async void selectPathBtn_Click(object sender, EventArgs e)
{ {
FolderBrowserDialog dialog = new FolderBrowserDialog(); FolderBrowserDialog dialog = new FolderBrowserDialog();
if (dialog.ShowDialog() == DialogResult.OK) if (dialog.ShowDialog() == DialogResult.OK)
{ {
folderPathTbox.Text = dialog.SelectedPath; folderPathTbox.Text = dialog.SelectedPath;
Log($"部署路径选择成功", Color.Green);
#region 测试 停止Nginx
var deployFoder = this.folderPathTbox.Text;
string nginxExtractName = "nginx-1.20.1";
string nginxStartPath = Path.Combine(deployFoder, @$"{nginxExtractName}\");
#region 创建进程执行命令
Process process = new Process();
process.StartInfo.FileName = "cmd.exe";
process.StartInfo.RedirectStandardInput = true;
process.StartInfo.UseShellExecute = false;
process.StartInfo.CreateNoWindow = true; // 不创建新窗口
process.Start();
var proList = Process.GetProcesses().Where(t => t.ProcessName.Contains("nginx") && t.MainModule.FileName.Contains(nginxStartPath));
foreach (var item in proList)
{
item.Kill();
}
await ProcessStandardInputAsync(process, $"sc stop {serviceNameTBox.Text}");
await ProcessStandardInputAsync(process, $"sc delete {serviceNameTBox.Text}");
process.StandardInput.Close();
process.WaitForExit();
#endregion
#endregion
} }
} }
} }
} }

View File

@ -26,9 +26,6 @@
<Content Include="deploy\nginx-1.20.1.rar"> <Content Include="deploy\nginx-1.20.1.rar">
<CopyToOutputDirectory>Always</CopyToOutputDirectory> <CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content> </Content>
<Content Include="deploy\ServiceConfig.Json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="deploy\sql\bin.bat"> <Content Include="deploy\sql\bin.bat">
<CopyToOutputDirectory>Always</CopyToOutputDirectory> <CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content> </Content>

View File

@ -1,5 +0,0 @@
{
"serviceName": "CertificateApply.NetCore.Api",
"serviceDisplayName": "CertificateApplyServiceDisplayName",
"binPath": "/IRacIS.Core.API.exe"
}