Bläddra i källkod

Merge branch 'master' of http://git.ius.plus:88/Project-Wing/WingCloudServer

arthur.wu 2 år sedan
förälder
incheckning
9fc15d1e98

+ 1 - 0
Publish.ps1

@@ -56,6 +56,7 @@ BuildService "WingAIDiagnosisService" 1 0 "../WingAIDiagnosisService"
 
 BuildService "WingLiveConsultationService" 1 0 "../WingLiveConsultationService"
 
+BuildService "WingRtcService" 1 0 "../WingRtcService"
 
 Write-Host 'Finished!' -NoNewline
 $null = [Console]::ReadKey('?')

+ 3 - 2
clone&pull tool.bat

@@ -1,7 +1,7 @@
 @echo off & color 0A
 @title git tool
 
-rem 当前文件夹名称
+rem 锟斤拷前锟侥硷拷锟斤拷锟斤拷锟斤拷
 pushd %1 & for %%i in (.) do set curr=%%~ni
 if "%curr%"=="WingCloudServer" (
 	cd ..
@@ -13,7 +13,7 @@ if "%curr%"=="WingCloudServer" (
 )
 
 :Main
-echo [正在检查获取远程代码,请勿关闭当前操作页]	
+echo [锟斤拷锟节硷拷锟斤拷取远锟教达拷锟诫,锟斤拷锟斤拷乇盏锟角帮拷锟斤拷锟揭砞	
 for /d %%i in (*) do (
 	cd %%i			
 	if exist *.git (
@@ -42,6 +42,7 @@ if not exist WingUserModule (git clone http://git.ius.plus:88/Project-Wing/WingU
 if not exist WingVinnoImageData (git clone http://git.ius.plus/Project-Wing/WingVinnoImageData.git && echo;)
 if not exist WingLiveConsultationService (git clone http://git.ius.plus/arthur.wu/WingLiveConsultationService.git && echo;)
 if not exist WingRtmpService (git clone http://git.ius.plus/arthur.wu/WingRtmpService.git && echo;)
+if not exist WingRtcService (git clone http://git.ius.plus/fly.wang/WingRtcService.git && echo;)
 
 echo Finished!
 pause>nul

+ 6 - 1
src/InteractionCenter/InteractionCenterService.cs

@@ -1,11 +1,16 @@
 using WingServerCommon.Service;
 using WingInterfaceLibrary.Interface.DBInterface;
+using WingInterfaceLibrary.LiveConsultation;
 
 namespace WingCloudServer.InteractionCenter
 {
     public class InteractionCenterService : JsonRpcService
     {
-        protected IOpLogDBService OpLogDBService;
+        protected IOpLogDBService _opLogDBService;
         
+        protected ILiveRoomDBService _liveRoomDBService;
+        protected IDistributedServerInfoDBService _distributedServerInfoDBService;
+        protected ILiveConsultationService _liveConsultationService;
     }
+
 }

+ 92 - 15
src/InteractionCenter/MasterInteractionCenterService.cs

@@ -4,37 +4,48 @@ using WingInterfaceLibrary.OpLog;
 using System.Threading.Tasks;
 using System.Collections.Generic;
 using WingInterfaceLibrary.Interface.DBInterface;
+using System.Linq;
+using WingServerCommon.Log;
+using CSScriptLib;
+using System.Reflection;
+using WingInterfaceLibrary.LiveConsultation;
 
 namespace WingCloudServer.InteractionCenter
 {
-    public class MasterInteractionCenterService : InteractionCenterService, IMasterInteractionCenterService
-    {        
+    public partial class MasterInteractionCenterService : InteractionCenterService, IMasterInteractionCenterService
+    {
+
+        private Dictionary<string, string> _serverUrlMap;
+
         public override void Load(JsonRpcClientPool jsonRpcClientPool)
         {
             base.Load(jsonRpcClientPool);
-            OpLogDBService = GetProxy<IOpLogDBService>();                        
+            _opLogDBService = GetProxy<IOpLogDBService>();
+            _distributedServerInfoDBService = GetProxy<IDistributedServerInfoDBService>();
+            _liveRoomDBService = GetProxy<ILiveRoomDBService>();
+            _liveConsultationService = GetProxy<ILiveConsultationService>();
+            _serverUrlMap = new Dictionary<string, string>();
         }
 
-        
         /// <summary>
         /// Get op logs from master server
         /// </summary>
         /// <param name="request"></param>
         /// <returns>The op log list</returns>
         public async Task<List<OperationLogDTO>> GetOpLogsFromMasterAsync(GetOpLogsFormMasterRequest request)
-        {            
-            return await OpLogDBService.GetOpLogAsync(request);
+        {
+            return await _opLogDBService.GetOpLogAsync(request);
         }
-        
+
         /// <summary>
         /// Get op logs from master server
         /// </summary>
         /// <param name="request"></param>
         /// <returns>The op log list</returns>
-        public async Task<List<OperationLogDTO>> GetOpLogsByCodeFromMasterAsync(GetOpLogsByCodeFormMasterRequest request)
-        {            
-            return await OpLogDBService.GetOpLogsByCodeAsync(request);
-        }     
+        public async Task<List<OperationLogDTO>> GetOpLogsByCodesFromMasterAsync(GetOpLogsByCodesFormMasterRequest request)
+        {
+            return await _opLogDBService.GetOpLogsByCodesAsync(request);
+        }
 
         /// <summary>
         /// Synchronize op log to master server
@@ -42,13 +53,79 @@ namespace WingCloudServer.InteractionCenter
         /// <param name="request"></param>
         /// <returns></returns>
         public async Task<bool> SyncOpLogToMasterAsync(SyncOpLogToMasterRequest request)
-        {            
-            return await OpLogDBService.SyncOpLogAsync(request);
-        }           
+        {
+            try
+            {
+                if (!_serverUrlMap.Any(x => x.Key == request.SourceUrl))
+                {
+                    DynamicAddRemoteService(request.ServerID, request.SourceUrl);
+                    _serverUrlMap.TryAdd(request.SourceUrl, request.ServerID);
+                }
+            }
+            catch (Exception ex)
+            {
+                Logger.WriteLineWarn("TryAdd-AddRemoteService:" + ex.ToString());
+            }
+            return await _opLogDBService.SyncOpLogAsync(request);
+        }
+
+        public void DynamicAddRemoteService(string serverID, string sourceUrl)
+        {
+
+            var eval = CSScript.Evaluator.ReferenceDomainAssemblies(DomainAssemblies.AllStaticNonGAC);
+            var str = @$"using System;
+                        using System.Threading.Tasks;
+                        using WingServerCommon.Service;
+                        using WingInterfaceLibrary.OpLog;
+                        using System.Collections.Generic;
+                        using JsonRpcLite.Rpc;
+                        using WingInterfaceLibrary.Interface.DBInterface;
+                        using WingCloudServer;
+                        using WingCloudServer.InteractionCenter;
+
+                        public interface IDynamicSlaveService{serverID}:IDynamicSlaveService
+                        {{
+                            Task<bool> DynamicSlaveAsync(SyncReceiveServiceDataRequest request);
+                        }}
+
+                        public class DynamicAddRemoteServiceClass
+                        {{
+                            public void DynamicAddRemoteMethod()
+                            {{
+                               WingServer.AddRemoteService<IDynamicSlaveService{serverID}>(""IDynamicSlaveService{serverID}"",""{sourceUrl}"");
+                            }}
+                        }}";
+            Assembly compilecode = eval.CompileCode(str);
+            var ps = compilecode.GetType("css_root+DynamicAddRemoteServiceClass");
+            var obj = compilecode.CreateInstance("css_root+DynamicAddRemoteServiceClass");
+            var mes = ps.GetMethod("DynamicAddRemoteMethod");
+            mes.Invoke(obj, null);
+        }
     }
 
     public class SlaveInteractionCenterService : InteractionCenterService, ISlaveInteractionCenterService
     {
-                  
+
+        public override void Load(JsonRpcClientPool jsonRpcClientPool)
+        {
+            base.Load(jsonRpcClientPool);
+            _opLogDBService = GetProxy<IOpLogDBService>();
+            _liveConsultationService = GetProxy<ILiveConsultationService>();
+        }
+
+        /// Sychronize Receive ServiceData for slave
+        public async Task<bool> SyncReceiveMasterServiceDataAsync(SyncReceiveServiceDataRequest request)
+        {
+            Logger.WriteLineInfo("SyncReceiveSlaveServiceDataAsync:" + request.ServiceDataJson + "," + request.ServerID);
+            //执行oplogs
+            if (request.Oplogs != null && request.Oplogs.Count > 0)
+            {
+                var syncCompleteOpLogsRequest = new SyncCompleteOpLogsRequest { Oplogs = request.Oplogs };
+                await _opLogDBService.SyncCompleteOpLogsAsync(syncCompleteOpLogsRequest);
+            }
+            await _liveConsultationService.SyncServerMessageAsync(request);
+
+            return true;
+        }
     }
 }

+ 91 - 0
src/InteractionCenter/MasterInteractionSyncService.cs

@@ -0,0 +1,91 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Reflection;
+using System.Threading.Tasks;
+using CSScriptLib;
+using Newtonsoft.Json;
+using WingInterfaceLibrary.DB.Request;
+using WingInterfaceLibrary.DTO.DistributedServerInfo;
+using WingInterfaceLibrary.Interface.DBInterface;
+using WingInterfaceLibrary.OpLog;
+using WingInterfaceLibrary.Request.DBRequest;
+using WingInterfaceLibrary.Result;
+using WingServerCommon.Config;
+using WingServerCommon.Config.Parameters;
+using WingServerCommon.Log;
+using WingServerCommon.Service;
+
+namespace WingCloudServer.InteractionCenter
+{
+    public partial class MasterInteractionCenterService : IMasterInteractionCenterService
+    {
+
+        private string _serverID = ConfigurationManager.GetParammeter<StringParameter>("General", "ServerID").Value;
+
+        /// <summary>
+        /// 主服务同步数据到副服务器
+        /// </summary>
+        /// <param name="request"></param>
+        /// <returns></returns>
+        public async Task<bool> SyncReceiveSlaveServiceDataAsync(SyncReceiveServiceDataRequest request)
+        {
+            Logger.WriteLineInfo("SyncReceiveSlaveServiceDataAsync:" + request.ServiceDataJson + "," + request.ServerID);
+            //判断是当前服务器并且是主服务器 则只需要发送oplogs到其他副服务器
+            var localServerUrl = ConfigurationManager.Host;
+            if (request.SourceUrl != localServerUrl)
+            {
+                await _liveConsultationService.SyncServerMessageAsync(request);
+            }
+            var baseLiveConsultation = JsonConvert.DeserializeObject<BaseLiveConsultationJson>(request.ServiceDataJson);
+            // 判断是否存在其他服务器的用户
+            var getLiveRoomByCodeDBRequest = new GetLiveRoomByCodeDBRequest();
+            getLiveRoomByCodeDBRequest.LiveRoomCode = baseLiveConsultation.RoomCode;
+            var roomDTO = await _liveRoomDBService.GetLiveRoomByCodeAsync(getLiveRoomByCodeDBRequest);
+            var users = roomDTO.UserInfos;
+            //操作人所在服务器
+            var operatorUser = users.FirstOrDefault(x => x.Code == baseLiveConsultation.OperatorCode);
+            //连接其他副服务器的用户
+            var usersConnectOtherSlave = users.Where(x => !string.IsNullOrWhiteSpace(x.LoginServerHost) && x.LoginServerHost != operatorUser.LoginServerHost && x.LoginServerHost != localServerUrl);
+            if (usersConnectOtherSlave != null && usersConnectOtherSlave.Count() > 0)
+            {
+                //获取oplogs
+                var getOpLogsByCodesFormMasterRequest = new GetOpLogsByCodesFormMasterRequest();
+                getOpLogsByCodesFormMasterRequest.Codes = new List<string> { baseLiveConsultation.ConsultationRecordCode, baseLiveConsultation.RoomCode };
+                var oplogs = await _opLogDBService.GetOpLogsByCodesAsync(getOpLogsByCodesFormMasterRequest);
+                request.Oplogs = oplogs;
+                //通知副服务器
+                var otherSlaves = usersConnectOtherSlave.Select(x => x.LoginServerHost).Distinct();
+                if (otherSlaves.Count() > 0)
+                {
+                    //动态注册副服务器服务
+                    var otherSlaveHosts = new List<string>();
+                    foreach (var item in otherSlaves)
+                    {
+                        try
+                        {
+                            var serverID = _serverUrlMap.FirstOrDefault(x => x.Key == item).Value;
+                            DynamicSlaveService(request, serverID);
+                        }
+                        catch (Exception ex)
+                        {
+                            Logger.WriteLineWarn("SyncReceiveSlaveServiceDataAsync-DynamicSlaveService:" + ex);
+                        }
+                    }
+                }
+            }
+            return true;
+        }
+
+        public void DynamicSlaveService(SyncReceiveServiceDataRequest request, string serverID)
+        {
+            var _dynamicService = WingServer.WingServerGetProxy($"IDynamicSlaveService{serverID}");
+            var result = _dynamicService.DynamicSlaveAsync(request).Result;
+        }
+    }
+
+    public interface IDynamicSlaveService
+    {
+        Task<bool> DynamicSlaveAsync(SyncReceiveServiceDataRequest request);
+    }
+}

+ 7 - 2
src/Plugin/TokenVerifyPluginService.cs

@@ -70,7 +70,12 @@ namespace WingCloudServer.Plugin
             "IVinnoServerService/EchoAsync",
             "IVinnoServerService/UpdateServerIPListAsync",
             "IAIDiagnosisService/DiagnosisImageAsync",
-            "IReportService/CreateReportTemplatePreviewAsync"
+            "IReportService/CreateReportTemplatePreviewAsync",
+            "IWingRtcService/GetRoomIdAsync",
+            "IWingRtcService/GenerateRoomUrlAsync",
+            "IWingRtcService/GetRtcSettingAsync",
+            "IWingRtcService/GetUserSignAsync",
+            "ILiveConsultationService/SyncServerMessageAsync",
         };
 
         public PluginProcessResult PreProcess(IJsonRpcHttpContext context, byte[] requestData)
@@ -78,7 +83,7 @@ namespace WingCloudServer.Plugin
             var dataLength = (int)context.GetRequestContentLength();
             var requests = JsonRpcCodec.DecodeRequestsAsync(requestData, new System.Threading.CancellationToken(), dataLength).Result;
             var apiName = $"{context.GetRequestPath().Trim('/')}/{requests[0].Method.Trim('/')}";
-            if (context.GetRequestPath() != "/IAuthenticationService" && context.GetRequestPath() != "/IMasterInteractionCenterService" && !NotValidationRequiredList.Contains(apiName))
+            if (context.GetRequestPath() != "/IAuthenticationService" && context.GetRequestPath() != "/IMasterInteractionCenterService" && !NotValidationRequiredList.Contains(apiName)&&!context.GetRequestPath().Contains("IDynamicSlaveService") )
             {
                 var tokenRequest = new ValidateTokenRequest();
                 try

+ 9 - 0
src/Resource/Languge/en-US/common.json

@@ -0,0 +1,9 @@
+{
+    "General": {
+        "Version": "1.0"
+    },
+    "Language": {
+        "PositionCode01": "Supervisor",
+        "PositionCode02": "Employee"
+    }
+}

+ 9 - 0
src/Resource/Languge/zh-CN/common.json

@@ -0,0 +1,9 @@
+{
+    "General": {
+        "Version": "1.0"
+    },
+    "Language": {
+        "PositionCode01": "主管",
+        "PositionCode02": "普通员工"
+    }
+}

+ 4 - 1
src/WingCloudServer.csproj

@@ -3,9 +3,11 @@
   <PropertyGroup>
     <OutputType>Exe</OutputType>
     <TargetFramework>net6.0</TargetFramework>
+    <SatelliteResourceLanguages>noneed</SatelliteResourceLanguages>
   </PropertyGroup>
 
-  <ItemGroup>    
+  <ItemGroup>   
+    <PackageReference Include="CS-Script.Core" Version="2.0.0" />     
     <PackageReference Include="Microsoft.Extensions.FileProviders.Physical" Version="5.0.0" />
     <PackageReference Include="WingInterfaceLibrary" Version="1.1.1.1" />
     <PackageReference Include="WingServerCommon" Version="1.1.1.1" />
@@ -21,6 +23,7 @@
     <PackageReference Include="JsonRpcLite" Version="1.1.0.4" />
     <PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="6.0.1" />
     <PackageReference Include="System.Runtime.Caching" Version="6.0.0" />
+    <PackageReference Include="zlib.net-mutliplatform" Version="1.0.6" />
     
     <Reference Include="AI.Common">
       <HintPath>..\AIDiagnosis\AI.Common.dll</HintPath>

+ 161 - 62
src/WingServer.cs

@@ -21,16 +21,21 @@ using WingInterfaceLibrary.Request.Authentication;
 using JsonRpcLite.Services;
 using WingInterfaceLibrary.Enum;
 using WingCloudServer.Plugin;
+using System.Reflection;
+using CSScriptLib;
 
 namespace WingCloudServer
 {
-    internal class WingServer
+    public class WingServer
     {
         private JsonRpcServer _rpcHttpServer;
         private JsonRpcServer _rpcInProcessServer;
         private JsonRpcInProcessEngine _inProcessEngine;
         private JsonRpcHttpServerEngine _jsonRpcHttpServerEngine;
         private Dictionary<Type, object> _rpcServices;
+        private static JsonRpcClientPool _rpcClientPool;
+        private static Dictionary<string, IDynamicSlaveService> _remoteServices = new Dictionary<string, IDynamicSlaveService>();
+
 
         public WingServer(string host)
         {
@@ -73,13 +78,56 @@ namespace WingCloudServer
             _rpcInProcessServer.Stop();
         }
 
+        /// <summary>
+        /// 动态添加远程服务
+        /// </summary>
+        /// <param name="serviceName"></param>
+        /// <param name="url"></param>
+        public static void AddRemoteService<T>(string serviceName, string url) where T : IDynamicSlaveService
+        {
+            try
+            {
+                if (_remoteServices.Any(x => x.Key == serviceName))
+                {
+                    return;
+                }
+                var serviceInfo = new RemoteServiceInfo()
+                {
+                    ServiceName = serviceName,
+                    Url = url
+                };
+                _rpcClientPool.Add(serviceInfo);
+
+                var service = _rpcClientPool.GetJsonRpcClient<T>().CreateProxy<T>();
+                _remoteServices.TryAdd(serviceName, service);
+            }
+            catch (Exception ex)
+            {
+                Logger.WriteLineWarn("AddService err" + ex);
+            }
+        }
+
+        public static IDynamicSlaveService WingServerGetProxy(string serviceName)
+        {
+            try
+            {
+                var service = _remoteServices.FirstOrDefault(x => x.Key == serviceName);
+                return service.Value;
+            }
+            catch (Exception ex)
+            {
+                Logger.WriteLineWarn("WingServerGetProxy err" + ex);
+            }
+            return null;
+        }
+
         void InitializeServices()
         {
             var folder = Path.Combine(AppDomain.CurrentDomain.BaseDirectory);
             //initiaize rpc client pool
             var remoteRpcHttpServices = LoadRemoteServiceConfig(folder);//new RemoteServiceInfo[0]; 
-            var rpcClientPool = new JsonRpcClientPool(_inProcessEngine);
-            rpcClientPool.Initialize(remoteRpcHttpServices.ToArray());
+            _rpcClientPool = new JsonRpcClientPool(_inProcessEngine);
+            _rpcClientPool.Initialize(remoteRpcHttpServices.ToArray());
             var inProcessServicesString = ConfigurationManager.GetParammeter<StringParameter>("Services", "InProcess").Value;
             var inProcessServices = inProcessServicesString.Split(',');
             var rpcHttpServicesString = ConfigurationManager.GetParammeter<StringParameter>("Services", "JsonRpcHttp").Value;
@@ -114,7 +162,6 @@ namespace WingCloudServer
                 }
             }
 
-
             //Rpc http service load and register to rpc http server
             if (ConfigurationManager.IsDistributed)
             {
@@ -122,12 +169,12 @@ namespace WingCloudServer
                 {
                     var masterInteractionCenterService = new MasterInteractionCenterService();
                     _rpcHttpServer.RegisterService(typeof(IMasterInteractionCenterService), masterInteractionCenterService);
-                    masterInteractionCenterService.Load(rpcClientPool);
-
+                    masterInteractionCenterService.Load(_rpcClientPool);
                 }
                 else
                 {
                     //TODO determin if we need to assess slave server on master server
+                    RegisterDynamicSlaveInteractionCenterService(_rpcClientPool);
                 }
             }
 
@@ -164,39 +211,91 @@ namespace WingCloudServer
             foreach (var service in _rpcServices)
             {
                 var method = service.Key.GetMethod("Load");
-                method.Invoke(service.Value, new object[] { rpcClientPool });
+                method.Invoke(service.Value, new object[] { _rpcClientPool });
             }
 
-            //load service if distrubuted system
-            if (ConfigurationManager.IsDistributed)
-            {
-                if (ConfigurationManager.IsMaster)
-                {
-                    //_rpcHttpServer.RegisterService(IMaster); TODO
-                }
-                else
-                {
-                    //TODO
-                }
-            }
             //最快服务器
             var vinnoServerService = new VinnoServerService();
             _rpcHttpServer.RegisterService(typeof(WingInterfaceLibrary.Interface.IVinnoServerService), vinnoServerService);
-            vinnoServerService.Load(rpcClientPool);
+            vinnoServerService.Load(_rpcClientPool);
 
             //plugin 
             _tokenVerifyPlugin = new TokenVerifyPlugin();
             _rpcHttpServer.RegisterService(typeof(ITokenVerifyPlugin), _tokenVerifyPlugin);
-            _tokenVerifyPlugin.Load(rpcClientPool);
+            _tokenVerifyPlugin.Load(_rpcClientPool);
             _ipAddressPlugin = new IPAddressPlugin();
             _rpcHttpServer.RegisterService(typeof(IIPAddressPlugin), _ipAddressPlugin);
-            _ipAddressPlugin.Load(rpcClientPool);
+            _ipAddressPlugin.Load(_rpcClientPool);
             _serverListPlugin = new ServerListPlugin();
             _rpcHttpServer.RegisterService(typeof(IServerListPlugin), _serverListPlugin);
-            _serverListPlugin.Load(rpcClientPool);
+            _serverListPlugin.Load(_rpcClientPool);
 
         }
 
+        /// <summary>
+        /// 副服务器动态服务
+        /// </summary>
+        /// <param name="rpcClientPool"></param>
+        public void RegisterDynamicSlaveInteractionCenterService(JsonRpcClientPool rpcClientPool)
+        {
+            try
+            {
+                var serverID = ConfigurationManager.GetParammeter<StringParameter>("General", "ServerID").Value;
+                //先注册 下面要调用
+                var slaveInteractionCenterService = new SlaveInteractionCenterService();
+                _rpcHttpServer.RegisterService(typeof(ISlaveInteractionCenterService), slaveInteractionCenterService);
+                slaveInteractionCenterService.Load(rpcClientPool);
+
+                var eval = CSScript.Evaluator.ReferenceDomainAssemblies(DomainAssemblies.AllStaticNonGAC);
+                var str = @$"
+                    using System;
+                    using System.Threading.Tasks;
+                    using WingServerCommon.Service;
+                    using WingInterfaceLibrary.OpLog;
+                    using System.Collections.Generic;
+                    using JsonRpcLite.Rpc;
+                    using WingInterfaceLibrary.Interface.DBInterface;
+                    using WingInterfaceLibrary.DB.Request;
+                                     
+                    public interface IDynamicSlaveService{serverID}
+                    {{
+                        Task<bool> DynamicSlaveAsync(SyncReceiveServiceDataRequest request);
+                    }}
+                    public class DynamicSlaveService : JsonRpcService,IDynamicSlaveService{serverID}
+                    {{
+                        protected ISlaveInteractionCenterService _slaveInteractionCenterService;
+                        public override void Load(JsonRpcClientPool jsonRpcClientPool)
+                        {{
+                            base.Load(jsonRpcClientPool);
+                            _slaveInteractionCenterService = GetProxy<ISlaveInteractionCenterService>();
+                        }}
+                        public async Task<bool> DynamicSlaveAsync(SyncReceiveServiceDataRequest request)
+                        {{
+                            await _slaveInteractionCenterService.SyncReceiveMasterServiceDataAsync(request);
+                            return true;
+                        }}
+                    }}
+                    public class DynamicMethodClass
+                     {{
+                        public void DynamicMethod(JsonRpcClientPool rpcClientPool,JsonRpcServer _rpcHttpServer) {{
+                            var DynamicSlaveService = new DynamicSlaveService();
+                            _rpcHttpServer.RegisterService(typeof(IDynamicSlaveService{serverID}), DynamicSlaveService);
+                            DynamicSlaveService.Load(rpcClientPool);
+                        }}
+                    }}
+                    ";
+                Assembly compilecode = eval.CompileCode(str);
+                var ps = compilecode.GetType("css_root+DynamicMethodClass");
+                var obj = compilecode.CreateInstance("css_root+DynamicMethodClass");
+                var mes = ps.GetMethod("DynamicMethod");
+                mes.Invoke(obj, new object[] { rpcClientPool, _rpcHttpServer });
+            }
+            catch (Exception ex)
+            {
+                Logger.WriteLineWarn("RegisterDynamicSlaveInteractionCenterService err:" + ex);
+            }
+        }
+
         void LoadDataAfterRegister()
         {
             foreach (var service in _rpcServices)
@@ -281,49 +380,49 @@ namespace WingCloudServer
             return resList;
         }
 
-    /// <summary>
-    /// 初始化AIDiagnosis
-    /// </summary>
-    private void InitAIDiagnosis()
-    {
-        try
-        {
-            var dllsRootPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "AIDiagnosis");
-            var destFolder = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Dependencies");
-            CopyFilesAndDirs(dllsRootPath, destFolder);
-        }
-        catch (Exception ex)
+        /// <summary>
+        /// 初始化AIDiagnosis
+        /// </summary>
+        private void InitAIDiagnosis()
         {
-            Logger.WriteLineError($"InitAIDiagnosis error:{ex}");
+            try
+            {
+                var dllsRootPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "AIDiagnosis");
+                var destFolder = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Dependencies");
+                CopyFilesAndDirs(dllsRootPath, destFolder);
+            }
+            catch (Exception ex)
+            {
+                Logger.WriteLineError($"InitAIDiagnosis error:{ex}");
+            }
         }
-    }
 
-    private void CopyFilesAndDirs(string sourceDir, string destDir)
-    {
-        if (!Directory.Exists(sourceDir))
-        {
-            return;
-        }
-        if (!Directory.Exists(destDir))
-        {
-            Directory.CreateDirectory(destDir);
-        }
-        string newPath;
-        FileInfo fileInfo;
-        string[] files = Directory.GetFiles(sourceDir);
-        foreach (string path in files)
-        {
-            fileInfo = new FileInfo(path);
-            newPath = destDir + "\\" + fileInfo.Name;
-            File.Copy(path, newPath, true);
-        }
-        string[] dirs = Directory.GetDirectories(sourceDir);
-        foreach (string path in dirs)
+        private void CopyFilesAndDirs(string sourceDir, string destDir)
         {
-            DirectoryInfo directory = new DirectoryInfo(path);
-            string newDir = destDir + "\\" + directory.Name;
-            CopyFilesAndDirs(path + "\\", newDir + "\\");
+            if (!Directory.Exists(sourceDir))
+            {
+                return;
+            }
+            if (!Directory.Exists(destDir))
+            {
+                Directory.CreateDirectory(destDir);
+            }
+            string newPath;
+            FileInfo fileInfo;
+            string[] files = Directory.GetFiles(sourceDir);
+            foreach (string path in files)
+            {
+                fileInfo = new FileInfo(path);
+                newPath = destDir + "\\" + fileInfo.Name;
+                File.Copy(path, newPath, true);
+            }
+            string[] dirs = Directory.GetDirectories(sourceDir);
+            foreach (string path in dirs)
+            {
+                DirectoryInfo directory = new DirectoryInfo(path);
+                string newDir = destDir + "\\" + directory.Name;
+                CopyFilesAndDirs(path + "\\", newDir + "\\");
+            }
         }
     }
-}
 }

+ 4 - 3
src/appsettings.json

@@ -3,7 +3,8 @@
     "Version": "1.0.0.0",
     "IsDistributed": false,
     "IsMaster": false,
-    "MasterUrl": ""
+    "MasterUrl": "",
+    "ServerID":""
   },
   "Gateway": {
     "Host": "http://127.0.0.1/",
@@ -17,7 +18,7 @@
     "CollectionName": "logs"
   },
   "Services": {
-    "InProcess": "WingEmailModule,WingMongoDBModule,WingSessionModule,WingSMSModule,WingNotificationModule,WingAIDiagnosisService",
+    "InProcess": "WingEmailModule,WingMongoDBModule,WingSessionModule,WingSMSModule,WingNotificationModule,WingAIDiagnosisService,WingRtcService",
     "JsonRpcHttp": "WingManagementModule,WingStorageModule,WingUserModule,WingDeviceService,WingRemedicalModule,ReportService,WingLiveConsultationService",
     "Remote": ""
   },
@@ -109,6 +110,6 @@
     "RTCBizid":71678,
     "RTCUseSSL":false,
     "RTCPlayDomain":"liveplay.fis.plus",
-    "RTCInitRoomId":0
+    "RTCInitRoomId":21000
   }
 }