diff --git a/CloudBuilder.Topshelf/.gitignore b/CloudBuilder.Topshelf/.gitignore
new file mode 100644
index 0000000..9547459
--- /dev/null
+++ b/CloudBuilder.Topshelf/.gitignore
@@ -0,0 +1,3 @@
+CloudBuilder.Topshelf/.vs
+CloudBuilder.Topshelf/obj
+CloudBuilder.Topshelf/bin
diff --git a/CloudBuilder.Topshelf/CloudBuilder.Topshelf.csproj b/CloudBuilder.Topshelf/CloudBuilder.Topshelf.csproj
new file mode 100644
index 0000000..acb035f
--- /dev/null
+++ b/CloudBuilder.Topshelf/CloudBuilder.Topshelf.csproj
@@ -0,0 +1,85 @@
+
+
+
+ Exe
+ net8.0
+ enable
+ enable
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ PreserveNewest
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Lib\CloudBuilder.Core.dll
+
+
+ Lib\CloudBuilder.Master.dll
+
+
+ Lib\CloudBuilder.Master.Service.dll
+
+
+ Lib\CloudBuilder.Request.dll
+
+
+ Lib\CloudBuilder.Security.dll
+
+
+ Lib\CloudBuilder.Security.Service.dll
+
+
+
+
diff --git a/CloudBuilder.Topshelf/CloudBuilder.Topshelf.csproj.user b/CloudBuilder.Topshelf/CloudBuilder.Topshelf.csproj.user
new file mode 100644
index 0000000..d8fb8a3
--- /dev/null
+++ b/CloudBuilder.Topshelf/CloudBuilder.Topshelf.csproj.user
@@ -0,0 +1,6 @@
+
+
+
+ <_LastSelectedProfileId>D:\Docker\CloudBuilder.Topshelf\Properties\PublishProfiles\FolderProfile.pubxml
+
+
\ No newline at end of file
diff --git a/CloudBuilder.Topshelf/CloudBuilder.Topshelf.sln b/CloudBuilder.Topshelf/CloudBuilder.Topshelf.sln
new file mode 100644
index 0000000..6059df4
--- /dev/null
+++ b/CloudBuilder.Topshelf/CloudBuilder.Topshelf.sln
@@ -0,0 +1,31 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 17
+VisualStudioVersion = 17.8.34316.72
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CloudBuilder.Topshelf", "CloudBuilder.Topshelf.csproj", "{63EB47F6-A616-4C64-B850-85ED294E2524}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CloudBuilder.Request", "..\CloudBuilder\CloudBuilder.Request\CloudBuilder.Request.csproj", "{8A0A5461-7F04-B87A-CE03-309E1D186FEC}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {63EB47F6-A616-4C64-B850-85ED294E2524}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {63EB47F6-A616-4C64-B850-85ED294E2524}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {63EB47F6-A616-4C64-B850-85ED294E2524}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {63EB47F6-A616-4C64-B850-85ED294E2524}.Release|Any CPU.Build.0 = Release|Any CPU
+ {8A0A5461-7F04-B87A-CE03-309E1D186FEC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {8A0A5461-7F04-B87A-CE03-309E1D186FEC}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {8A0A5461-7F04-B87A-CE03-309E1D186FEC}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {8A0A5461-7F04-B87A-CE03-309E1D186FEC}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {24F7770A-0647-4A47-B147-80AFD34ACB87}
+ EndGlobalSection
+EndGlobal
diff --git a/CloudBuilder.Topshelf/Lib/CloudBuilder.Core.dll b/CloudBuilder.Topshelf/Lib/CloudBuilder.Core.dll
new file mode 100644
index 0000000..7ce9ade
Binary files /dev/null and b/CloudBuilder.Topshelf/Lib/CloudBuilder.Core.dll differ
diff --git a/CloudBuilder.Topshelf/Lib/CloudBuilder.Master.Service.dll b/CloudBuilder.Topshelf/Lib/CloudBuilder.Master.Service.dll
new file mode 100644
index 0000000..aaf06d5
Binary files /dev/null and b/CloudBuilder.Topshelf/Lib/CloudBuilder.Master.Service.dll differ
diff --git a/CloudBuilder.Topshelf/Lib/CloudBuilder.Master.dll b/CloudBuilder.Topshelf/Lib/CloudBuilder.Master.dll
new file mode 100644
index 0000000..c420bed
Binary files /dev/null and b/CloudBuilder.Topshelf/Lib/CloudBuilder.Master.dll differ
diff --git a/CloudBuilder.Topshelf/Lib/CloudBuilder.Request.dll b/CloudBuilder.Topshelf/Lib/CloudBuilder.Request.dll
new file mode 100644
index 0000000..8ed8ec8
Binary files /dev/null and b/CloudBuilder.Topshelf/Lib/CloudBuilder.Request.dll differ
diff --git a/CloudBuilder.Topshelf/Lib/CloudBuilder.Security.Service.dll b/CloudBuilder.Topshelf/Lib/CloudBuilder.Security.Service.dll
new file mode 100644
index 0000000..e5eedaa
Binary files /dev/null and b/CloudBuilder.Topshelf/Lib/CloudBuilder.Security.Service.dll differ
diff --git a/CloudBuilder.Topshelf/Lib/CloudBuilder.Security.dll b/CloudBuilder.Topshelf/Lib/CloudBuilder.Security.dll
new file mode 100644
index 0000000..60b31ea
Binary files /dev/null and b/CloudBuilder.Topshelf/Lib/CloudBuilder.Security.dll differ
diff --git a/CloudBuilder.Topshelf/Program.cs b/CloudBuilder.Topshelf/Program.cs
new file mode 100644
index 0000000..199d0bd
--- /dev/null
+++ b/CloudBuilder.Topshelf/Program.cs
@@ -0,0 +1,158 @@
+using CloudBuilder;
+using CloudBuilder.Core.Authorization;
+using CloudBuilder.Core.DatabaseAccessor;
+using CloudBuilder.Core.DatabaseAccessor.Entity;
+using CloudBuilder.Core.DependencyInjection.Form;
+using CloudBuilder.Core.DependencyInjection.Request;
+using CloudBuilder.Core.DependencyInjection.Task;
+using CloudBuilder.Core.Policy;
+using CloudBuilder.Core.Service;
+using CloudBuilder.Request.Security;
+using CloudBuilder.Security.Data;
+using CloudBuilder.Security.Policy;
+using CloudBuilder.Topshelf.Task;
+using Microsoft.AspNetCore.Http;
+using Microsoft.Extensions.DependencyInjection;
+using System.Reflection;
+using System.Text;
+
+public partial class Program
+{
+ ///
+ /// request:Y 要求调用webApi参数
+ ///
+ ///
+ static void Main(string[] args)
+ {
+ try
+ {
+ // 设置控制台编码为UTF-8,解决中文乱码问题
+ Console.OutputEncoding = Encoding.UTF8;
+ Console.InputEncoding = Encoding.UTF8;
+ Directory.SetCurrentDirectory(AppDomain.CurrentDomain.BaseDirectory);
+
+ string taskName = null;
+ Dictionary bodyDict = new Dictionary();
+
+ File.AppendAllText("log.txt", "Main:" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "\r\n");
+
+ if (args != null && args.Length > 0)
+ {
+ var services = new ServiceCollection();
+
+ services.Initialize();
+
+ var serviceProvider = services.BuildServiceProvider();
+
+ ApplicationServiceContext applicationServiceContext = serviceProvider.GetService()!;
+
+ string key = null;
+ string[] temp = null;
+
+ foreach (string s in args)
+ {
+ temp = s.Split(new char[] { ':' }, 2, StringSplitOptions.RemoveEmptyEntries);
+ if (temp.Length <= 1) continue;
+ if (temp[1] == null || temp[1].Trim() == string.Empty) continue;
+
+ key = temp[0].Trim();
+
+ if (key == "task")
+ {
+ taskName = temp[1];// config.TaskMappings.Where(x => x.Task == temp[1]).FirstOrDefault();
+ if (taskName == null) continue;
+
+ continue;
+ }
+
+ if (bodyDict.ContainsKey(key)) continue;
+
+ bodyDict.Add(key, temp[1]);
+ }
+
+ if (string.IsNullOrEmpty(taskName)) return;
+
+ try
+ {
+
+ IApplicationService applicationService = serviceProvider.GetService();
+ applicationService.UserId = applicationService.Configuration["IApplicationService:UserId"];
+ //如果有传入用户ID,则使用传入的用户ID
+ if (bodyDict.ContainsKey("user_id"))
+ {
+ applicationService.UserId = bodyDict["user_id"];
+ }
+
+ IEnumerable tasks = serviceProvider.GetServices();
+
+ foreach (var task in tasks)
+ {
+ if (task.GetType().Name.ToLower() != taskName.ToLower()) continue;
+
+ if (bodyDict.ContainsKey("request") && bodyDict["request"].ToUpper().Trim() == "Y") Login(applicationService);
+
+ task.Run(bodyDict);
+ }
+
+ }
+ catch (Exception ex)
+ {
+ Console.WriteLine($"[{ex.Message}]");
+ }
+ finally
+ {
+ Environment.Exit(0);
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ Console.WriteLine(ex.ToString());
+ }
+ }
+
+ static void Login(IApplicationService applicationService)
+ {
+ #region 系统用户登录
+ try
+ {
+ LoginData loginData = new LoginData();
+ //从容器获取请求对象
+ AuthRequest authRequest = ServiceHelper.GetTypeService();
+ //获取RSA公钥
+ string pubKey = authRequest.GetRsaPublicKey();
+ //加密用户密码
+ string psw = applicationService.Configuration["CloudBuilder:SecurityUser:UserPassword"]!;
+ loginData.Guid = psw.Substring(0, 36);
+ var rsa = new RSA(pubKey, true);
+ loginData.UserMobile = applicationService.Configuration["CloudBuilder:SecurityUser:UserMobile"]!;
+ loginData.RsaUserPassword = rsa.Encode(psw);
+ //设置当前文化
+ loginData.Culture = CulturePolicy.ZH_CN;
+
+ LoginProfile loginProfile;
+
+ loginProfile = authRequest.Login(loginData);
+
+ IContext loginContext = ServiceHelper.GetInterfaceService()!;
+ //登录成功后设置登录上下文
+ loginContext.Requestor = loginProfile.Username;
+ loginContext.SetPermissionInfo(loginProfile.PermissionInfo);
+ loginContext.SetToken(loginProfile.Token.AccessToken);
+ loginContext.LoginDate = DateTime.Now;
+ }
+ catch (Exception ex)
+ {
+ throw ex;
+ }
+
+ //ISecurityMasterService securityMasterService = service.ServiceProvider.GetService();
+
+ //SecurityMasterEntityKey key = new SecurityMasterEntityKey();
+ //key.MasterCodeItem = "default_work_shift";
+ //key.MasterCategory = "CloudBuilder.Hr.Policy.Master";
+ //key.MasterSubcategory = "StaffWorkShiftPolicy";
+ //SecurityMasterEntity securityMaster = securityMasterService.FindByKey(key);
+ #endregion
+ }
+}
\ No newline at end of file
diff --git a/CloudBuilder.Topshelf/Properties/PublishProfiles/FolderProfile.pubxml b/CloudBuilder.Topshelf/Properties/PublishProfiles/FolderProfile.pubxml
new file mode 100644
index 0000000..db6d39f
--- /dev/null
+++ b/CloudBuilder.Topshelf/Properties/PublishProfiles/FolderProfile.pubxml
@@ -0,0 +1,16 @@
+
+
+
+
+ Release
+ Any CPU
+ bin\Release\net8.0\publish\linux-x64\
+ FileSystem
+ <_TargetId>Folder
+ net8.0
+ linux-x64
+ true
+ false
+ false
+
+
\ No newline at end of file
diff --git a/CloudBuilder.Topshelf/Properties/PublishProfiles/FolderProfile.pubxml.user b/CloudBuilder.Topshelf/Properties/PublishProfiles/FolderProfile.pubxml.user
new file mode 100644
index 0000000..66d5cf0
--- /dev/null
+++ b/CloudBuilder.Topshelf/Properties/PublishProfiles/FolderProfile.pubxml.user
@@ -0,0 +1,8 @@
+
+
+
+
+ True|2026-09-21T03:59:35.1020536Z||;True|2026-09-21T11:50:47.8944224+08:00||;True|2026-09-21T11:30:52.9019631+08:00||;True|2026-09-21T10:47:01.8026331+08:00||;
+
+
+
\ No newline at end of file
diff --git a/CloudBuilder.Topshelf/Properties/launchSettings.json b/CloudBuilder.Topshelf/Properties/launchSettings.json
new file mode 100644
index 0000000..658a7ba
--- /dev/null
+++ b/CloudBuilder.Topshelf/Properties/launchSettings.json
@@ -0,0 +1,8 @@
+{
+ "profiles": {
+ "CloudBuilder.Topshelf": {
+ "commandName": "Project",
+ "commandLineArgs": "task:RunTask request:Y"
+ }
+ }
+}
\ No newline at end of file
diff --git a/CloudBuilder.Topshelf/Task/RunTask.cs b/CloudBuilder.Topshelf/Task/RunTask.cs
new file mode 100644
index 0000000..899aaa2
--- /dev/null
+++ b/CloudBuilder.Topshelf/Task/RunTask.cs
@@ -0,0 +1,34 @@
+using CloudBuilder.Core.DatabaseAccessor.Entity;
+using CloudBuilder.Core.DependencyInjection.Task;
+using Microsoft.Extensions.Configuration;
+
+namespace CloudBuilder.Topshelf.Task
+{
+ //task:RunTask param_name:param_value
+ public class RunTask : IScheduleTask
+ {
+ private readonly IApplicationService service;
+ private readonly IConfiguration config;
+
+ public RunTask(IApplicationService service, IConfiguration config)
+ {
+ this.service = service;
+ this.config = config;
+ }
+
+ public void Run(Dictionary bodyDict)
+ {
+ File.AppendAllText("log.txt", "RunTask:" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "\r\n");
+ try
+ {
+ new FileLog(config).WriteToFile("RunTask");
+ }
+ catch (Exception ex)
+ {
+ File.AppendAllText("log.txt", "RunTask:" + ex.Message);
+ throw;
+ }
+
+ }
+ }
+}
diff --git a/CloudBuilder.Topshelf/appsettings.json b/CloudBuilder.Topshelf/appsettings.json
new file mode 100644
index 0000000..ccfba76
--- /dev/null
+++ b/CloudBuilder.Topshelf/appsettings.json
@@ -0,0 +1,33 @@
+{
+ "Logging": {
+ "LogFileDirectory": "D:\\Net8\\FileServer\\Log",
+ "MaxFileSizeMB": 20
+ },
+ "CloudBuilder": {
+ "Culture": "zh-cn",
+ "DbContexts": {
+ "MasterDbContext": {
+ "DbContextTypeName": "MasterDbContext",
+ "ConnectionString": "server=nas.youjiala.com;port=3307;database=builder;uid=root;pwd=Root@1237890;CharSet=utf8mb4;",
+ "DatabaseType": "MySql",
+ "LazyLoadingProxiesEnabled": true,
+ "AuditEntityEnabled": true,
+ "AutoMigrationEnabled": true
+ }
+ },
+ "ServiceRequest": {
+ "BaseAddress": "https://uat.youjiala.com", //通过Request是需要用户权限及服务器支持
+ "DefaultRequestHeaders": {
+ "Accept": "application/json"
+ }
+ },
+ "SecurityUser": {
+ "UserPassword": "1b457798-6d49-4b37-93a4-a6e105cce84b202cb962ac59075b964b07152d234b70",
+ "UserMobile": "13560851330"
+ }
+ },
+ "IApplicationService": {
+ "UserId": "000003" //通过Service是不需要用户权限而直接调用
+ },
+ "AllowedHosts": "*"
+}