提交 dcd408a6 编写于 作者: L liumanduo

修复rpc远程控制Bug

上级 8c2b50b9
...@@ -66,10 +66,10 @@ namespace IoTSharp.Services.MQTTControllers ...@@ -66,10 +66,10 @@ namespace IoTSharp.Services.MQTTControllers
} }
} }
[MqttRoute("request/{method}/{requestId}")] [MqttRoute("request/{method}")]
public async Task request(string method,string requestId) public async Task request(string method)
{ {
_logger.LogInformation($"收到客户端{ClientId}请求ID为{requestId}rpc请求方法{method}。"); _logger.LogInformation($"收到客户端{ClientId}rpc请求方法{method}。");
var p_dev = _dev.DeviceType == DeviceType.Gateway ? device : _dev; var p_dev = _dev.DeviceType == DeviceType.Gateway ? device : _dev;
var rules = await _caching.GetAsync($"ruleid_{p_dev.Id}_rpc_{method}", async () => var rules = await _caching.GetAsync($"ruleid_{p_dev.Id}_rpc_{method}", async () =>
{ {
...@@ -83,13 +83,13 @@ namespace IoTSharp.Services.MQTTControllers ...@@ -83,13 +83,13 @@ namespace IoTSharp.Services.MQTTControllers
, TimeSpan.FromSeconds(_settings.RuleCachingExpiration)); , TimeSpan.FromSeconds(_settings.RuleCachingExpiration));
if (rules.HasValue && rules.Value!=Guid.Empty) if (rules.HasValue && rules.Value!=Guid.Empty)
{ {
var obj = new { Message.Topic, Payload = Convert.ToBase64String(Message.Payload), ClientId, RPCMethod = method, RequestId = requestId }; var obj = new { Message.Topic, Payload = Convert.ToBase64String(Message.Payload), ClientId, RPCMethod = method };
_logger.LogInformation($"客户端{ClientId}请求ID为{requestId}rpc请求方法{method}通过规则链{rules.Value}进行处理。"); _logger.LogInformation($"客户端{ClientId}rpc请求方法{method}通过规则链{rules.Value}进行处理。");
await _flowRuleProcessor.RunFlowRules(rules.Value, obj, p_dev.Id, FlowRuleRunType.Normal, null); await _flowRuleProcessor.RunFlowRules(rules.Value, obj, p_dev.Id, FlowRuleRunType.Normal, null);
} }
else else
{ {
_logger.LogInformation($"客户端{ClientId}请求ID为{requestId}rpc请求方法{method}尚未委托规则链。"); _logger.LogInformation($"客户端{ClientId}rpc请求方法{method}尚未委托规则链。");
} }
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册