CrazyIter_Bin 5 months ago
parent
commit
caea78162d

+ 1 - 1
TEAMModelOS.Extension/HTEX.DataETL/HTEX.DataETL.csproj

@@ -8,7 +8,7 @@
 
   <ItemGroup>
     <ProjectReference Include="..\HTEX.Lib\HTEX.Lib.csproj" />
-    <ProjectReference Include="..\TEAMModelOS.SDK\TEAMModelOS.SDK.csproj" />
+    <ProjectReference Include="..\..\TEAMModelOS.SDK\TEAMModelOS.SDK.csproj" />
   </ItemGroup>
 	<ItemGroup>
 		<Content Include="..\HTEX.Lib\summary.xml">

+ 26 - 26
TEAMModelOS.Extension/IES.Exam/IES.ExamClient/app.js

@@ -3,40 +3,40 @@ const { spawn } = require('child_process');
 const net = require('net');
 
 let dotnetProcess;
-const startDotnet = () => {
-    return new Promise((resolve, reject) => {
-        dotnetProcess = spawn('dotnet', ['run', '--project', '../IES.ExamServer/IES.ExamServer.csproj']);
-        dotnetProcess.stdout.on('data', (data) => {
-            console.log(`stdout: ${data}`);
-            // 假设dotnet服务启动后会输出包含"Now listening on"的日志
-            if (data.toString().includes('Now listening on')) {
-                resolve();
-            }
-        });
-
-        dotnetProcess.stderr.on('data', (data) => {
-            console.log(`stderr: ${data}`);
-            reject(new Error(`Dotnet process error: ${data}`));
-        });
-
-        dotnetProcess.on('close', (code) => {
-            console.log(`child process exited with code ${code}`);
-            if (code !== 0) {
-                reject(new Error(`Dotnet process exited with code ${code}`));
-            }
-        });
-    });
-};
+//const startDotnet = () => {
+//    return new Promise((resolve, reject) => {
+//        dotnetProcess = spawn('dotnet', ['run', '--project', '../IES.ExamServer/IES.ExamServer.csproj']);
+//        dotnetProcess.stdout.on('data', (data) => {
+//            console.log(`stdout: ${data}`);
+//            // 假设dotnet服务启动后会输出包含"Now listening on"的日志
+//            if (data.toString().includes('Now listening on')) {
+//                resolve();
+//            }
+//        });
+
+//        dotnetProcess.stderr.on('data', (data) => {
+//            console.log(`stderr: ${data}`);
+//            reject(new Error(`Dotnet process error: ${data}`));
+//        });
+
+//        dotnetProcess.on('close', (code) => {
+//            console.log(`child process exited with code ${code}`);
+//            if (code !== 0) {
+//                reject(new Error(`Dotnet process exited with code ${code}`));
+//            }
+//        });
+//    });
+//};
 
 const createWindow = async () => {
     try {
-        await startDotnet();
+        //await startDotnet();
         const win = new BrowserWindow({
             width: 800,
             height: 600
         });
         win.maximize();
-        win.loadURL('https://localhost:5001/api/WeatherForecast');
+        win.loadURL('https://localhost:5001');
     } catch (error) {
         console.error('Error starting dotnet or loading window:', error);
     }

+ 1 - 1
TEAMModelOS.Extension/IES.Exam/IES.ExamClient/package.json

@@ -11,7 +11,7 @@
   "author": "",
   "license": "ISC",
   "devDependencies": {
-    "electron": "^33.2.1",
+    "electron": "21.4.4",
     "eslint": "^9.17.0"
   }
 }

+ 1 - 1
TEAMModelOS.Extension/IES.Exam/IES.ExamServer/ClientApp/package.json

@@ -1,5 +1,5 @@
 {
-  "name": "app",
+  "name": "ies.examwebview",
   "version": "0.1.0",
   "private": true,
   "scripts": {

BIN
TEAMModelOS.Extension/IES.Exam/IES.ExamServer/Configs/logo.png


+ 0 - 32
TEAMModelOS.Extension/IES.Exam/IES.ExamServer/Controllers/HomeController.cs

@@ -1,32 +0,0 @@
-using IES.ExamServer.Models;
-using Microsoft.AspNetCore.Mvc;
-using System.Diagnostics;
-
-namespace IES.ExamServer.Controllers
-{
-    public class HomeController : Controller
-    {
-        private readonly ILogger<HomeController> _logger;
-
-        public HomeController(ILogger<HomeController> logger)
-        {
-            _logger = logger;
-        }
-
-        public IActionResult Index()
-        {
-            return View();
-        }
-
-        public IActionResult Privacy()
-        {
-            return View();
-        }
-
-        [ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
-        public IActionResult Error()
-        {
-            return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
-        }
-    }
-}

+ 228 - 0
TEAMModelOS.Extension/IES.Exam/IES.ExamServer/Controllers/InitController.cs

@@ -0,0 +1,228 @@
+using IES.ExamServer.Models;
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.Extensions.Caching.Memory;
+using System.Diagnostics;
+using System.Text.Json.Nodes;
+using System.Text.Json;
+using IES.ExamServer.Helper;
+using System.DrawingCore.Imaging;
+using System.DrawingCore;
+using System.IdentityModel.Tokens.Jwt;
+
+namespace IES.ExamServer.Controllers
+{
+    [ApiController]
+    [Route("init")]
+  
+    public class InitController : ControllerBase
+    {
+        private readonly IConfiguration _configuration;
+        private readonly IHttpClientFactory _httpClientFactory;
+        private readonly IMemoryCache _memoryCache;
+        private readonly ILogger<InitController> _logger;
+
+        public InitController(ILogger<InitController> logger, IConfiguration configuration, IHttpClientFactory httpClientFactory, IMemoryCache memoryCache)
+        {
+            _logger = logger;
+            _configuration=configuration;
+            _httpClientFactory=httpClientFactory;
+            _memoryCache=memoryCache;
+        }
+        [HttpPost("device")]
+        public async Task<IActionResult> Device()
+        {
+            int code = 0;
+            string msg = string.Empty;
+            try
+            {
+
+                _memoryCache.TryGetValue(Constant._KeyServerCenter, out JsonNode? data);
+                if (data!=null)
+                {
+                    return Ok(new { code = 200, msg = "云端服务连接成功!", data = data });
+                }
+                else
+                {
+                    code=500;
+                    msg="云端服务未连接!";
+                }
+
+
+            }
+            catch (Exception ex)
+            {
+                code=500;
+                msg="云端服务未连接!";
+            }
+            return Ok(new { code, msg });
+        }
+
+
+        /**
+        {
+            "type":"sms",//qrcode二维码扫码登录:randomCode必传;  sms 短信验证登录:randomCode必传,mobile必传
+            "randomCode",
+            "mobile":"1528377****"
+        }
+        **/
+        /// <summary>
+        /// 登录验证
+        /// </summary>
+        /// <param name="randomCode"></param>
+        /// <returns></returns>
+        [HttpPost("login-check")]
+        public async Task<IActionResult> LoginCheck(JsonNode json)
+        {
+            int code = 0;
+            string msg = string.Empty;
+            try
+            {
+                var type = json["type"];
+                string? CenterUrl = _configuration.GetValue<string>("ExamServer:CenterUrl");
+                if (!string.IsNullOrWhiteSpace($"{type}"))
+                {
+                    TmdidImplicit? token = null;
+                    string x_auth_token = string.Empty;
+                    List<School>? schools = null;
+                    JsonNode? jsonNode = null;
+                    switch (true)
+                    {
+                        case bool when $"{type}".Equals("qrcode"):
+                            {
+                                string randomCode = $"{json["randomCode"]}";
+                                System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls12;
+
+                                var response = await _httpClientFactory.CreateClient().GetAsync($"{CenterUrl}/hita/check-login?code={randomCode}");
+                                if (response.IsSuccessStatusCode)
+                                {
+                                    string content = await response.Content.ReadAsStringAsync();
+                                    if (!string.IsNullOrWhiteSpace(content))
+                                    {
+                                        jsonNode = JsonSerializer.Deserialize<JsonNode>(content);
+
+                                    }
+                                    else
+                                    {
+                                        code=400;
+                                        msg="随机码验证失败";
+                                    }
+                                }
+                                else
+                                {
+                                    code=400;
+                                    msg="随机码验证错误";
+                                }
+                                break;
+                            }
+                        case bool when $"{type}".Equals("smspin"):
+                            {
+                                string pin_code = $"{json["pin_code"]}";
+                                string account = $"{json["account"]}";
+                                var response = await _httpClientFactory.CreateClient().PostAsJsonAsync($"{CenterUrl}/core/sendsms/check", new { pin_code, account });
+                                if (response.IsSuccessStatusCode)
+                                {
+                                    string content = await response.Content.ReadAsStringAsync();
+                                    if (!string.IsNullOrWhiteSpace(content))
+                                    {
+                                        jsonNode = JsonSerializer.Deserialize<JsonNode>(content);
+                                    }
+                                    else
+                                    {
+                                        code=400;
+                                        msg="短信验证返回结果为空";
+                                    }
+                                }
+                                else
+                                {
+                                    code=400;
+                                    msg="短信验证错误";
+                                }
+                                break;
+                            }
+
+                    }
+                    if (jsonNode != null  && $"{jsonNode["code"]}".Equals("200"))
+                    {
+                        token = JsonSerializer.Deserialize<TmdidImplicit>(jsonNode["implicit_token"]);
+                        x_auth_token = $"{jsonNode["x_auth_token"]}";
+                        schools = JsonSerializer.Deserialize<List<School>>(jsonNode["schools"]);
+                        var jwt = new JwtSecurityToken(token?.id_token);
+                        var id = jwt.Payload.Sub;
+                        jwt.Payload.TryGetValue("name", out object? name);
+                        jwt.Payload.TryGetValue("picture", out object? picture);
+                        _memoryCache.Set($"Teacher:{id}", new LoginTeacher { id=id, name=$"{name}", implicit_token= token, picture=$"{picture}", schools=schools, x_auth_token=x_auth_token });
+                        return Ok(new { implicit_token = token, x_auth_token = x_auth_token, schools = schools });
+                    }
+                    else
+                    {
+                        code=400;
+                        msg="验证失败";
+                    }
+                }
+                else
+                {
+                    code=400;
+                    msg="参数错误";
+                }
+            }
+            catch (Exception ex)
+            {
+                code=500;
+                msg="异常错误";
+            }
+            return Ok(new { code = code });
+        }
+        /// <summary>
+        /// 登录模式初始化
+        /// </summary>
+        /// <returns></returns>
+        [HttpGet("/login-init")]
+        public async Task<IActionResult> LoginInit(JsonNode json)
+        {
+            var type = json["type"];
+            string qrcode = string.Empty;
+            string randomCode = "";
+            switch (true)
+            {
+                case bool when $"{type}".Equals("qrcode"):
+                    {
+                        // 生成二维码图片
+                        Random random = new Random();
+                        randomCode = $"{random.Next(1000, 9999)}";
+                        string? CenterUrl = _configuration.GetValue<string>("ExamServer:CenterUrl");
+                        string content = $"{CenterUrl}/joinSchool?schoolCode=login:{randomCode}&m=%E7%99%BB%E5%BD%95&o=1";
+                        Bitmap qrCodeImage = QRCodeHelper.GetBitmap(content, 200, 200);
+                        using (MemoryStream stream = new MemoryStream())
+                        {
+                            qrCodeImage.Save(stream, ImageFormat.Png);
+                            byte[] data = stream.ToArray();
+                            qrcode=$"data:image/png;base64,{Convert.ToBase64String(data)}";
+                        }
+                        return Ok(new { code = 200, randomCode = randomCode, qrcode, type });
+                    }
+                case bool when $"{type}".Equals("smspin"):
+                    {
+                        int send = 0;
+                        if (!string.IsNullOrWhiteSpace($"{json["area"]}") &&  !string.IsNullOrWhiteSpace($"{json["to"]}"))
+                        {
+                            string? CenterUrl = _configuration.GetValue<string>("ExamServer:CenterUrl");
+                            string url = $"{CenterUrl}/core/sendsms/pin";
+                            HttpResponseMessage message = await _httpClientFactory.CreateClient().PostAsJsonAsync(url, new { });
+                            if (message.IsSuccessStatusCode)
+                            {
+                                string content = await message.Content.ReadAsStringAsync();
+                                JsonNode? jsonNode = JsonSerializer.Deserialize<JsonNode>(content);
+                                if (jsonNode!=null && int.TryParse($"{jsonNode["send"]}", out int s))
+                                {
+                                    send = s;
+                                }
+                            }
+                        }
+                        return Ok(new { code = 200, send, type });
+                    }
+            }
+            return Ok(new { code = 400 });
+        }
+
+    }
+}

+ 68 - 0
TEAMModelOS.Extension/IES.Exam/IES.ExamServer/DI/LiteDBFactory.cs

@@ -0,0 +1,68 @@
+using LiteDB;
+using Microsoft.Extensions.DependencyInjection;
+using Microsoft.Extensions.DependencyInjection.Extensions;
+using Microsoft.Extensions.Logging;
+using Microsoft.Extensions.Options;
+using System;
+using System.Collections.Concurrent;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace IES.ExamServer.DI
+{
+    public class LiteDBFactory
+    {
+        private readonly IServiceProvider _services;
+        private readonly IOptionsMonitor<LiteDBFactoryOptions> _optionsMonitor;
+        private readonly ILogger _logger;
+        private ConcurrentDictionary<string, LiteDatabase> LiteDatabases { get; } = new ConcurrentDictionary<string, LiteDatabase>();
+        public LiteDBFactory(IServiceProvider services, IOptionsMonitor<LiteDBFactoryOptions> optionsMonitor, ILogger<LiteDBFactory> logger)
+        {
+            if (services == null) throw new ArgumentNullException(nameof(services));
+            if (optionsMonitor == null) throw new ArgumentNullException(nameof(optionsMonitor));
+
+            _services = services;
+            _optionsMonitor = optionsMonitor;
+            _logger = logger;
+        }
+
+        public LiteDatabase GetLiteDatabase(string name = "Master")
+        {
+            try
+            {
+                var DB = LiteDatabases.GetOrAdd(name, x => new LiteDatabase(_optionsMonitor.Get(name).Connectionstring));
+                return DB;
+            }
+            catch (Exception e)
+            {
+                _logger?.LogWarning(e, e.Message);
+                return null;
+            }
+        }
+    }
+    public class LiteDBFactoryOptions
+    {
+        public string? Name { get; set; }
+        public string? Connectionstring { get; set; }
+    }
+    public static class LiteDBFactoryExtensions
+    {
+        public static IServiceCollection AddLiteDB(this IServiceCollection services, List<LiteDBFactoryOptions> connectionstrings)
+        {
+            if (services == null) throw new ArgumentNullException(nameof(services));
+            if (connectionstrings == null) throw new ArgumentNullException(nameof(connectionstrings));
+
+
+            services.TryAddSingleton<LiteDBFactory>();
+            //多个连接字符串注入
+            connectionstrings.ForEach(connection =>
+            {
+                services.Configure<LiteDBFactoryOptions>(connection.Name, o => { o.Name = connection.Name; o.Connectionstring = connection.Connectionstring; });
+            });
+
+            return services;
+        }
+    }
+}

+ 68 - 0
TEAMModelOS.Extension/IES.Exam/IES.ExamServer/DI/SignalRHost/SignalRExamServerHub.cs

@@ -0,0 +1,68 @@
+using Microsoft.AspNetCore.SignalR;
+using Microsoft.Extensions.Logging;
+
+
+namespace IES.ExamServer.DI.SignalRHost
+{
+    public  class SignalRExamServerHub : Hub<IClient>
+    {
+        private readonly ILogger<SignalRExamServerHub> _logger;
+      
+        public SignalRExamServerHub(ILogger<SignalRExamServerHub> logger)
+        {
+            _logger = logger;
+           
+        }
+    }
+    public interface IClient
+    {
+        Task ReceiveMessage(MessageBody message);
+        Task ReceiveConnection(MessageBody message);
+        Task ReceiveDisConnection(MessageBody message);
+    }
+    public abstract class MessageBody
+    {
+        public MessageBody()
+        {
+            time = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
+        }
+        /// <summary>
+        /// 连接id
+        /// </summary>
+        public virtual string? connid { get; set; }
+        /// <summary>
+        /// 客户端id
+        /// </summary>
+        public virtual string? clientid { get; set; }
+        /// <summary>
+        /// 状态  busy 忙碌,free 空闲,down 离线,error 错误
+        /// </summary>
+        public virtual string? status { get; set; }
+        /// <summary>
+        /// 消息内容
+        /// </summary>
+        public virtual string? content { get; set; }
+        /// <summary>
+        /// 消息创建时间
+        /// </summary>
+        public virtual long time { get; }
+        /// <summary>
+        /// 授权类型,bookjs_api 
+        /// </summary>
+        public virtual string? grant_type { get; set; }
+        /// <summary>
+        /// 消息类型
+        /// </summary>
+        public virtual MessageType message_type { get; set; }
+
+    }
+    public enum MessageType
+    {
+        conn_success,//连接成功
+        conn_error,// 连接失败
+        task_send_success,// 任务发送成功
+        task_send_error,// 任务发送失败
+        task_execute_success,// 任务执行成功
+        task_execute_error,// 任务执行失败
+    }
+}

+ 13 - 0
TEAMModelOS.Extension/IES.Exam/IES.ExamServer/Helpers/Constant.cs

@@ -0,0 +1,13 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace IES.ExamServer.Helper
+{
+    public static class Constant
+    {
+        public static string _KeyServerCenter = "Server:Center:Data";
+    }
+}

File diff suppressed because it is too large
+ 54 - 0
TEAMModelOS.Extension/IES.Exam/IES.ExamServer/Helpers/QRCodeHelper.cs


+ 4 - 1
TEAMModelOS.Extension/IES.Exam/IES.ExamServer/IES.ExamServer.csproj

@@ -31,7 +31,10 @@
 	  </None>
 	</ItemGroup>
 	<ItemGroup>
-	  <PackageReference Include="VueCliMiddleware" Version="6.0.0" />
+		<PackageReference Include="LiteDB" Version="5.0.21" />
+		<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="8.3.0" />
+		<PackageReference Include="VueCliMiddleware" Version="6.0.0" />
+		<PackageReference Include="ZXing.Net.Bindings.ZKWeb.System.Drawing" Version="0.16.7" />
 	</ItemGroup>
 
 	<ItemGroup>

+ 43 - 0
TEAMModelOS.Extension/IES.Exam/IES.ExamServer/Models/Teacher.cs

@@ -0,0 +1,43 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace IES.ExamServer.Models
+{
+    public class Teacher
+    {
+        public string? id {  get; set; }
+        public string? name { get; set; }
+        public string? picture {  get; set; }
+        public string? x_auth_token {  get; set; }
+        public string? access_token { get; set; }
+        public List<School> schools { get; set; }= new List<School>();
+    }
+
+    public class School
+    {
+        public string? id { get; set; }
+        public string? name { get; set; }
+        public string? picture { get; set; }
+    }
+    [Serializable]
+    public class TmdidImplicit
+    {
+        public string? id_token { get; set; }
+        public string? access_token { get; set; }
+        public string? expires_in { get; set; }
+        public string? token_type { get; set; }
+    }
+
+    public class LoginTeacher 
+    {
+        public string? id { get; set; }
+        public string? name { get; set; }
+        public string? picture { get; set; }
+        public string? x_auth_token { get;set; }
+        public TmdidImplicit? implicit_token { get; set; }
+        public List<School>? schools{ get;set;}= new List<School>();
+    }
+}

+ 86 - 9
TEAMModelOS.Extension/IES.Exam/IES.ExamServer/Program.cs

@@ -1,17 +1,53 @@
+using IES.ExamServer.DI;
+using IES.ExamServer.DI.SignalRHost;
+using IES.ExamServer.Helper;
 using Microsoft.AspNetCore.SpaServices;
+using Microsoft.AspNetCore.StaticFiles;
+using Microsoft.Extensions.Caching.Memory;
+using System.Text.Json;
+using System.Text.Json.Nodes;
 using VueCliMiddleware;
 
 namespace IES.ExamServer
 {
     public class Program
     {
-        public static void Main(string[] args)
+        public async static Task Main(string[] args)
         {
             var builder = WebApplication.CreateBuilder(args);
+            builder.Configuration.SetBasePath(Directory.GetCurrentDirectory()).AddJsonFile("appsettings.json", optional: true, reloadOnChange: true);
             builder.Services.AddSpaStaticFiles(opt => opt.RootPath = "ClientApp/dist");
             // Add services to the container.
             builder.Services.AddControllersWithViews();
+            builder.Services.AddHttpClient();
+            builder.Services.AddSignalR();
+            builder.Services.AddHttpContextAccessor();
+            string localAppDataPath = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
+            string dbpath = $"{localAppDataPath}\\ExamServer\\LiteDB";
+            if (!System.IO.Directory.Exists(dbpath))
+            {
+                System.IO.Directory.CreateDirectory(dbpath);
+            }
+            string liteDBPath = $"Filename={dbpath}\\data.db;Connection=shared";
+
+            var connections_LiteDB = new List<LiteDBFactoryOptions>
+            {
+                new LiteDBFactoryOptions { Name = "Master", Connectionstring = liteDBPath}
+            };
+            builder.Services.AddLiteDB(connections_LiteDB);
+            builder.Services.AddMemoryCache();
+            string path = $"{builder.Environment.ContentRootPath}/Configs";
+            builder.Services.AddCors(options =>
+            {
+                options.AddDefaultPolicy(
+                builder =>
+                {
 
+                    builder.AllowAnyOrigin()
+                            .AllowAnyHeader()
+                            .AllowAnyMethod();
+                });
+            });
             var app = builder.Build();
 
             // Configure the HTTP request pipeline.
@@ -24,17 +60,22 @@ namespace IES.ExamServer
             else { app.UseDeveloperExceptionPage(); }
 
             app.UseHttpsRedirection();
-            app.UseStaticFiles();
+            app.UseDefaultFiles();
+            var contentTypeProvider = new FileExtensionContentTypeProvider();
+            contentTypeProvider.Mappings[".glb"] = "model/gltf-binary";
+            app.UseStaticFiles(new StaticFileOptions
+            {
+                ContentTypeProvider = contentTypeProvider,
+            });
 
             app.UseRouting();
 
             app.UseAuthorization();
 
-            //app.MapControllerRoute(
-            //    name: "default",
-            //    pattern: "{controller=Home}/{action=Index}/{id?}");
+            
             app.UseEndpoints(endpoints =>
             {
+                endpoints.MapHub<SignalRExamServerHub>("/signalr/screen").RequireCors("any");
                 endpoints.MapControllers();
 
                 // NOTE: VueCliProxy is meant for developement and hot module reload
@@ -48,7 +89,7 @@ namespace IES.ExamServer
                  npm install -g @vue
                  vue create app
                  */
-#if DEBUG
+//#if DEBUG
                 endpoints.MapToVueCliProxy(
                     "{*path}",
                     new SpaOptions { SourcePath = "ClientApp" },
@@ -56,11 +97,47 @@ namespace IES.ExamServer
                     // regex: "Compiled successfully",
                     forceKill: true
                     );
-#else
-                endpoints.MapFallbackToFile("index.html");
-#endif
+//#else
+//                endpoints.MapFallbackToFile("index.html");
+//#endif
             });
+            IMemoryCache? cache = app.Services.GetRequiredService<IMemoryCache>();
+            IHttpClientFactory? clientFactory = app.Services.GetRequiredService<IHttpClientFactory>();
+            LiteDBFactory liteDBFactory = app.Services.GetRequiredService<LiteDBFactory>();
+            JsonNode? data = null;
+            try
+            {
+                string? CenterUrl = builder.Configuration.GetValue<string>("ExamServer:CenterUrl");
+                var httpclient = clientFactory.CreateClient();
+                httpclient.Timeout=  TimeSpan.FromSeconds(10);
+                HttpResponseMessage message = await httpclient.PostAsJsonAsync($"{CenterUrl}/core/system-info", new { });
+                if (message.IsSuccessStatusCode)
+                {
+                    string content = await message.Content.ReadAsStringAsync();
+                    data = JsonSerializer.Deserialize<JsonNode>(content);
+                    data!["centerUrl"]=CenterUrl;
+                    cache.Set(Constant._KeyServerCenter, data);
+                    SystemInfo? system = JsonSerializer.Deserialize<SystemInfo>(data);
+                    system!.id= $"{DateTimeOffset.Now.ToUnixTimeMilliseconds()}";
+                    liteDBFactory.GetLiteDatabase().GetCollection<SystemInfo>("System").Insert(system);
+                }
+            }
+            catch (Exception ex)
+            {
+            }
             app.Run();
         }
     }
+    public class SystemInfo
+    {
+        public string? id { get; set; }
+        public string? version { get; set; }
+        public string? description { get; set; }
+        public long nowtime { get; set; }
+        public string? region { get; set; }
+        public string? ip { get; set; }
+        public string? date { get; set; }
+        public string? centerUrl { get; set; }
+
+    }
 }

+ 16 - 1
TEAMModelOS.Extension/IES.Exam/IES.ExamServer/appsettings.json

@@ -5,5 +5,20 @@
       "Microsoft.AspNetCore": "Warning"
     }
   },
-  "AllowedHosts": "*"
+  "AllowedHosts": "*",
+  "Kestrel": {
+    "Endpoints": {
+      "Http": {
+        "Url": "http://*:5000"
+      },
+      "Https": {
+        "Url": "https://*:5001"
+      }
+    }
+  },
+  "ExamServer": {
+    "Timeout": 30000,
+    "Delay": 500,
+    "CenterUrl": "https://www.teammodel.cn"
+  }
 }

+ 1 - 1
TEAMModelOS.Extension/IESHybridCloud/IESHybridCloud.csproj

@@ -19,7 +19,7 @@
   </ItemGroup>
 
   <ItemGroup>
-    <ProjectReference Include="..\TEAMModelOS.SDK\TEAMModelOS.SDK.csproj" />
+    <ProjectReference Include="..\..\TEAMModelOS.SDK\TEAMModelOS.SDK.csproj" />
   </ItemGroup>
 
 </Project>

+ 1 - 1
TEAMModelOS/Controllers/Third/IRS/ThirdIRSController.cs

@@ -147,7 +147,7 @@ namespace TEAMModelOS.Controllers
                                                 JsonElement json = content.ToObject<JsonElement>();
                                                 if (json.GetProperty("code").GetInt32()==0)
                                                 {
-                                                   // await _dingDing.SendBotMsg($"{_option.Location},139zhxy电子学生证任务推送成功。\n{json.GetProperty("message").GetString()}{data.ToJsonString()}", GroupNames.成都开发測試群組);
+                                                    await _dingDing.SendBotMsg($"{_option.Location},139zhxy电子学生证任务推送成功。\n{json.GetProperty("message").GetString()}{data.ToJsonString()}", GroupNames.成都开发測試群組);
                                                 }
                                                 else
                                                 {

File diff suppressed because it is too large
+ 28 - 28
TEAMModelOS/appsettings.Development.json