【修改】 试卷软件环境检测
This commit is contained in:
@@ -10,5 +10,7 @@ namespace Applications
|
|||||||
{
|
{
|
||||||
public string Id { get; set; }
|
public string Id { get; set; }
|
||||||
public string appName { get; set; }
|
public string appName { get; set; }
|
||||||
|
|
||||||
|
public string taskId { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -63,6 +63,8 @@ class Program
|
|||||||
// 需要被打包的 源目录路径
|
// 需要被打包的 源目录路径
|
||||||
string sourceDir = context.Request.QueryString["sourceDir"];
|
string sourceDir = context.Request.QueryString["sourceDir"];
|
||||||
string ip = context.Request.QueryString["ip"];
|
string ip = context.Request.QueryString["ip"];
|
||||||
|
// 方案ID
|
||||||
|
string taskId = context.Request.QueryString["taskId"];
|
||||||
string action = context.Request.Url.AbsolutePath.ToLower();
|
string action = context.Request.Url.AbsolutePath.ToLower();
|
||||||
string responseMessage = "";
|
string responseMessage = "";
|
||||||
// 压缩文件方法
|
// 压缩文件方法
|
||||||
@@ -197,12 +199,8 @@ class Program
|
|||||||
}
|
}
|
||||||
else if (action == "/start")
|
else if (action == "/start")
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
if (path == "navicat")
|
if (path == "navicat")
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
// 启动指定服务(MySQL 服务)//需要用管理员身份启动
|
// 启动指定服务(MySQL 服务)//需要用管理员身份启动
|
||||||
string serviceName = "wampmysqld"; // ← 请确认服务名
|
string serviceName = "wampmysqld"; // ← 请确认服务名
|
||||||
try
|
try
|
||||||
@@ -226,10 +224,6 @@ class Program
|
|||||||
{
|
{
|
||||||
Console.WriteLine($"❌ 启动服务失败:{ex.Message}");
|
Console.WriteLine($"❌ 启动服务失败:{ex.Message}");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 获取当前用户的 SID
|
// 获取当前用户的 SID
|
||||||
string userSid = WindowsIdentity.GetCurrent().User?.Value;
|
string userSid = WindowsIdentity.GetCurrent().User?.Value;
|
||||||
if (userSid == null)
|
if (userSid == null)
|
||||||
@@ -237,10 +231,7 @@ class Program
|
|||||||
Console.WriteLine("❌ 无法获取当前用户 SID");
|
Console.WriteLine("❌ 无法获取当前用户 SID");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
string subKeyPath = $@"{userSid}\Software\PremiumSoft\Navicat\Servers\答题专用";
|
string subKeyPath = $@"{userSid}\Software\PremiumSoft\Navicat\Servers\答题专用";
|
||||||
|
|
||||||
|
|
||||||
Console.WriteLine("当前用户 subKeyPath" + subKeyPath);
|
Console.WriteLine("当前用户 subKeyPath" + subKeyPath);
|
||||||
|
|
||||||
try
|
try
|
||||||
@@ -401,7 +392,7 @@ class Program
|
|||||||
}
|
}
|
||||||
else if (action == "/check")
|
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<AppCheck> softwareList = await FetchSoftwareListFromApi(apiUrl);
|
||||||
List<string> result = new List<string>();
|
List<string> result = new List<string>();
|
||||||
foreach (AppCheck softwareLine in softwareList)
|
foreach (AppCheck softwareLine in softwareList)
|
||||||
|
Reference in New Issue
Block a user