Skip to content

Commit

Permalink
Merge pull request #1066 from liumanduo/master
Browse files Browse the repository at this point in the history
修复rpc远程控制Bug
  • Loading branch information
maikebing committed Jul 24, 2023
2 parents d26148d + dcd408a commit 47cf931
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions IoTSharp/Services/MQTTControllers/RpcController.cs
Expand Up @@ -66,10 +66,10 @@ public string devname
}
}

[MqttRoute("request/{method}/{requestId}")]
public async Task request(string method,string requestId)
[MqttRoute("request/{method}")]
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 rules = await _caching.GetAsync($"ruleid_{p_dev.Id}_rpc_{method}", async () =>
{
Expand All @@ -83,13 +83,13 @@ public async Task request(string method,string requestId)
, TimeSpan.FromSeconds(_settings.RuleCachingExpiration));
if (rules.HasValue && rules.Value!=Guid.Empty)
{
var obj = new { Message.Topic, Payload = Convert.ToBase64String(Message.Payload), ClientId, RPCMethod = method, RequestId = requestId };
_logger.LogInformation($"客户端{ClientId}请求ID为{requestId}rpc请求方法{method}通过规则链{rules.Value}进行处理。");
var obj = new { Message.Topic, Payload = Convert.ToBase64String(Message.Payload), ClientId, RPCMethod = method };
_logger.LogInformation($"客户端{ClientId}rpc请求方法{method}通过规则链{rules.Value}进行处理。");
await _flowRuleProcessor.RunFlowRules(rules.Value, obj, p_dev.Id, FlowRuleRunType.Normal, null);
}
else
{
_logger.LogInformation($"客户端{ClientId}请求ID为{requestId}rpc请求方法{method}尚未委托规则链。");
_logger.LogInformation($"客户端{ClientId}rpc请求方法{method}尚未委托规则链。");
}
}
}
Expand Down

0 comments on commit 47cf931

Please sign in to comment.