【修改】 试卷软件环境检测

This commit is contained in:
dlaren
2025-08-07 15:38:23 +08:00
parent 12e53ba758
commit c1bbd46a32
2 changed files with 5 additions and 12 deletions

View File

@@ -10,5 +10,7 @@ namespace Applications
{
public string Id { get; set; }
public string appName { get; set; }
public string taskId { get; set; }
}
}

View File

@@ -63,6 +63,8 @@ class Program
// 需要被打包的 源目录路径
string sourceDir = context.Request.QueryString["sourceDir"];
string ip = context.Request.QueryString["ip"];
// 方案ID
string taskId = context.Request.QueryString["taskId"];
string action = context.Request.Url.AbsolutePath.ToLower();
string responseMessage = "";
// 压缩文件方法
@@ -197,12 +199,8 @@ class Program
}
else if (action == "/start")
{
if (path == "navicat")
{
// 启动指定服务MySQL 服务)//需要用管理员身份启动
string serviceName = "wampmysqld"; // ← 请确认服务名
try
@@ -226,10 +224,6 @@ class Program
{
Console.WriteLine($"❌ 启动服务失败:{ex.Message}");
}
// 获取当前用户的 SID
string userSid = WindowsIdentity.GetCurrent().User?.Value;
if (userSid == null)
@@ -237,10 +231,7 @@ class Program
Console.WriteLine("❌ 无法获取当前用户 SID");
return;
}
string subKeyPath = $@"{userSid}\Software\PremiumSoft\Navicat\Servers\答题专用";
Console.WriteLine("当前用户 subKeyPath" + subKeyPath);
try
@@ -401,7 +392,7 @@ class Program
}
else if (action == "/check")
{
string apiUrl = "http://" + ip + ":48080/admin-api/exam/app/getAppCheckList"; // ← 替换成你的接口地址
string apiUrl = "http://" + ip + ":48080/admin-api/exam/app/getAppCheckList/" + taskId; // ← 替换成你的接口地址
List<AppCheck> softwareList = await FetchSoftwareListFromApi(apiUrl);
List<string> result = new List<string>();
foreach (AppCheck softwareLine in softwareList)