// Admin.NET 项目的版æƒã€å•†æ ‡ã€ä¸“利和其他相关æƒåˆ©å‡å—ç›¸åº”æ³•å¾‹æ³•è§„çš„ä¿æŠ¤ã€‚ä½¿ç”¨æœ¬é¡¹ç›®åº”éµå®ˆç›¸å…³æ³•律法规和许å¯è¯çš„è¦æ±‚。 // // 本项目主è¦éµå¾ª MIT 许å¯è¯å’Œ Apache 许å¯è¯ï¼ˆç‰ˆæœ¬ 2.0)进行分å‘和使用。许å¯è¯ä½äºŽæºä»£ç æ ‘æ ¹ç›®å½•ä¸çš„ LICENSE-MIT å’Œ LICENSE-APACHE 文件。 // // ä¸å¾—利用本项目从事å±å®³å›½å®¶å®‰å…¨ã€æ‰°ä¹±ç¤¾ä¼šç§©åºã€ä¾µçŠ¯ä»–äººåˆæ³•æƒç›Šç‰æ³•å¾‹æ³•è§„ç¦æ¢çš„æ´»åЍï¼ä»»ä½•基于本项目二次开å‘è€Œäº§ç”Ÿçš„ä¸€åˆ‡æ³•å¾‹çº çº·å’Œè´£ä»»ï¼Œæˆ‘ä»¬ä¸æ‰¿æ‹…ä»»ä½•è´£ä»»ï¼ using AlibabaCloud.SDK.Dysmsapi20170525.Models; using AngleSharp.Html.Parser; using AspNet.Security.OAuth.Gitee; using AspNet.Security.OAuth.Weixin; using AspNetCoreRateLimit; using Elastic.Clients.Elasticsearch; using IPTools.Core; using Lazy.Captcha.Core; using Magicodes.ExporterAndImporter.Pdf; using Magicodes.ExporterAndImporter.Word; using MailKit.Net.Smtp; using Novell.Directory.Ldap; using OnceMi.AspNetCore.OSS; using QRCoder; namespace Admin.NET.Core.Service; /// <summary> /// 系统æœåŠ¡å™¨ç›‘æŽ§æœåŠ¡ 🧩 /// </summary> [ApiDescriptionSettings(Order = 290)] public class SysServerService : IDynamicApiController, ITransient { public SysServerService() { } /// <summary> /// èŽ·å–æœåС噍é…ç½®ä¿¡æ¯ ðŸ”– /// </summary> /// <returns></returns> [DisplayName("èŽ·å–æœåС噍é…置信æ¯")] public dynamic GetServerBase() { return new { HostName = Environment.MachineName, // 主机åç§° SystemOs = ComputerUtil.GetOSInfo(),//RuntimeInformation.OSDescription, // æ“作系统 OsArchitecture = Environment.OSVersion.Platform.ToString() + " " + RuntimeInformation.OSArchitecture.ToString(), // 系统架构 ProcessorCount = Environment.ProcessorCount + " æ ¸", // CPUæ ¸å¿ƒæ•° SysRunTime = ComputerUtil.GetRunTime(), // 系统è¿è¡Œæ—¶é—´ RemoteIp = ComputerUtil.GetIpFromOnline(), // å¤–ç½‘åœ°å€ LocalIp = App.HttpContext?.Connection?.LocalIpAddress.MapToIPv4().ToString(), // æœ¬åœ°åœ°å€ RuntimeInformation.FrameworkDescription, // NET框架 Environment = App.HostEnvironment.IsDevelopment() ? "Development" : "Production", Wwwroot = App.WebHostEnvironment.WebRootPath, // ç½‘ç«™æ ¹ç›®å½• Stage = App.HostEnvironment.IsStaging() ? "Stage环境" : "éžStage环境", // 是å¦Stage环境 }; } /// <summary> /// èŽ·å–æœåŠ¡å™¨ä½¿ç”¨ä¿¡æ¯ ðŸ”– /// </summary> /// <returns></returns> [DisplayName("èŽ·å–æœåŠ¡å™¨ä½¿ç”¨ä¿¡æ¯")] public dynamic GetServerUsed() { var programStartTime = Process.GetCurrentProcess().StartTime; var totalMilliseconds = (DateTime.Now - programStartTime).TotalMilliseconds.ToString(); var ts = totalMilliseconds.Contains('.') ? totalMilliseconds.Split('.')[0] : totalMilliseconds; var programRunTime = DateTimeUtil.FormatTime(ts.ParseToLong()); var memoryMetrics = ComputerUtil.GetComputerInfo(); return new { memoryMetrics.FreeRam, // ç©ºé—²å†…å˜ memoryMetrics.UsedRam, // å·²ç”¨å†…å˜ memoryMetrics.TotalRam, // æ€»å†…å˜ memoryMetrics.RamRate, // 内å˜ä½¿ç”¨çއ memoryMetrics.CpuRate, // Cpu使用率 StartTime = programStartTime.ToString("yyyy-MM-dd HH:mm:ss"), // æœåŠ¡å¯åŠ¨æ—¶é—´ RunTime = programRunTime, // æœåŠ¡è¿è¡Œæ—¶é—´ }; } /// <summary> /// èŽ·å–æœåС噍ç£ç›˜ä¿¡æ¯ 🔖 /// </summary> /// <returns></returns> [DisplayName("èŽ·å–æœåС噍ç£ç›˜ä¿¡æ¯")] public dynamic GetServerDisk() { return ComputerUtil.GetDiskInfos(); } /// <summary> /// èŽ·å–æ¡†æž¶ä¸»è¦ç¨‹åºé›† 🔖 /// </summary> /// <returns></returns> [DisplayName("èŽ·å–æ¡†æž¶ä¸»è¦ç¨‹åºé›†")] public dynamic GetAssemblyList() { var furionAssembly = typeof(App).Assembly.GetName(); var sqlSugarAssembly = typeof(ISqlSugarClient).Assembly.GetName(); var yitIdAssembly = typeof(YitIdHelper).Assembly.GetName(); var redisAssembly = typeof(Redis).Assembly.GetName(); var jsonAssembly = typeof(NewtonsoftJsonMvcCoreBuilderExtensions).Assembly.GetName(); var excelAssembly = typeof(IExcelImporter).Assembly.GetName(); var pdfAssembly = typeof(IPdfExporter).Assembly.GetName(); var wordAssembly = typeof(IWordExporter).Assembly.GetName(); var captchaAssembly = typeof(ICaptcha).Assembly.GetName(); var wechatApiAssembly = typeof(WechatApiClient).Assembly.GetName(); var wechatTenpayAssembly = typeof(WechatTenpayClient).Assembly.GetName(); var ossAssembly = typeof(IOSSServiceFactory).Assembly.GetName(); var parserAssembly = typeof(Parser).Assembly.GetName(); var elasticsearchClientAssembly = typeof(ElasticsearchClient).Assembly.GetName(); var limitAssembly = typeof(IpRateLimitMiddleware).Assembly.GetName(); var htmlParserAssembly = typeof(HtmlParser).Assembly.GetName(); var fluentEmailAssembly = typeof(SmtpClient).Assembly.GetName(); var qRCodeGeneratorAssembly = typeof(QRCodeGenerator).Assembly.GetName(); var sendSmsRequestAssembly = typeof(SendSmsRequest).Assembly.GetName(); var imageAssembly = typeof(Image).Assembly.GetName(); var rabbitMQAssembly = typeof(RabbitMQEventSourceStore).Assembly.GetName(); var ldapConnectionAssembly = typeof(LdapConnection).Assembly.GetName(); var ipToolAssembly = typeof(IpTool).Assembly.GetName(); var weixinAuthenticationOptionsAssembly = typeof(WeixinAuthenticationOptions).Assembly.GetName(); var giteeAuthenticationOptionsAssembly = typeof(GiteeAuthenticationOptions).Assembly.GetName(); return new[] { new { furionAssembly.Name, furionAssembly.Version }, new { sqlSugarAssembly.Name, sqlSugarAssembly.Version }, new { yitIdAssembly.Name, yitIdAssembly.Version }, new { redisAssembly.Name, redisAssembly.Version }, new { jsonAssembly.Name, jsonAssembly.Version }, new { excelAssembly.Name, excelAssembly.Version }, new { pdfAssembly.Name, pdfAssembly.Version }, new { wordAssembly.Name, wordAssembly.Version }, new { captchaAssembly.Name, captchaAssembly.Version }, new { wechatApiAssembly.Name, wechatApiAssembly.Version }, new { wechatTenpayAssembly.Name, wechatTenpayAssembly.Version }, new { ossAssembly.Name, ossAssembly.Version }, new { parserAssembly.Name, parserAssembly.Version }, new { elasticsearchClientAssembly.Name, elasticsearchClientAssembly.Version }, new { limitAssembly.Name, limitAssembly.Version }, new { htmlParserAssembly.Name, htmlParserAssembly.Version }, new { fluentEmailAssembly.Name, fluentEmailAssembly.Version }, new { qRCodeGeneratorAssembly.Name, qRCodeGeneratorAssembly.Version }, new { sendSmsRequestAssembly.Name, sendSmsRequestAssembly.Version }, new { imageAssembly.Name, imageAssembly.Version }, new { rabbitMQAssembly.Name, rabbitMQAssembly.Version }, new { ldapConnectionAssembly.Name, ldapConnectionAssembly.Version }, new { ipToolAssembly.Name, ipToolAssembly.Version }, new { weixinAuthenticationOptionsAssembly.Name, weixinAuthenticationOptionsAssembly.Version }, new { giteeAuthenticationOptionsAssembly.Name, giteeAuthenticationOptionsAssembly.Version }, }; } }