/// <summary> 订阅配置 </summary> /// <param name="modules">模块</param> /// <param name="env">环境模式</param> /// <returns></returns> public async Task Subscript(string[] modules, string env) { if (string.IsNullOrWhiteSpace(Code)) { return; } Logger.LogInformation($"hub:{Context.ConnectionId} Subscript {env} - {string.Join(',', modules)}"); foreach (var mode in modules) { await Groups.AddToGroupAsync(Context.ConnectionId, $"{Code}_{mode}_{env}"); } if (ProjectId.IsNotNullOrEmpty()) { using var scope = CurrentIocManager.BeginLifetimeScope(); var contract = scope.Resolve <IConfigContract>(); var dict = new Dictionary <string, object>(); foreach (var module in modules) { var config = await contract.GetAsync(ProjectId, module, env); dict.Add(module, config); } await Clients.Caller.SendAsync("UPDATE", dict); } }