From e9a187520cfb9404e840fe1e0f096360e582d5e6 Mon Sep 17 00:00:00 2001 From: lixxxww <941403820@qq.com> Date: Tue, 23 Jan 2024 12:21:01 +0000 Subject: [PATCH] =?UTF-8?q?=E9=80=82=E9=85=8Dkit=E5=8C=85=E7=9A=84?= =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: lixxxww <941403820@qq.com> --- apps/system/api/user.go | 23 ++++++++++++----------- iothub/client/mqttclient/rpc.go | 4 ++-- pkg/rule_engine/instance.go | 10 +++++----- 3 files changed, 19 insertions(+), 18 deletions(-) diff --git a/apps/system/api/user.go b/apps/system/api/user.go index a009786..a7b62b0 100644 --- a/apps/system/api/user.go +++ b/apps/system/api/user.go @@ -1,25 +1,26 @@ package api import ( - "github.com/PandaXGO/PandaKit/model" - "github.com/PandaXGO/PandaKit/token" + "pandax/apps/system/api/form" + "pandax/apps/system/api/vo" + "pandax/apps/system/entity" + "pandax/kit/model" + "pandax/kit/token" + "github.com/dgrijalva/jwt-go" "github.com/emicklei/go-restful/v3" "github.com/kakuilan/kgo" "github.com/mssola/user_agent" - "pandax/apps/system/api/form" - "pandax/apps/system/api/vo" - "pandax/apps/system/entity" logEntity "pandax/apps/log/entity" logServices "pandax/apps/log/services" - "github.com/PandaXGO/PandaKit/biz" - "github.com/PandaXGO/PandaKit/captcha" - filek "github.com/PandaXGO/PandaKit/file" - "github.com/PandaXGO/PandaKit/restfulx" - "github.com/PandaXGO/PandaKit/utils" "pandax/apps/system/services" + "pandax/kit/biz" + "pandax/kit/captcha" + filek "pandax/kit/file" + "pandax/kit/restfulx" + "pandax/kit/utils" "pandax/pkg/global" "strings" "time" @@ -37,7 +38,7 @@ type UserApi struct { // GenerateCaptcha 获取验证码 func (u *UserApi) GenerateCaptcha(request *restful.Request, response *restful.Response) { - id, image := captcha.Generate() + id, image, _ := captcha.Generate() response.WriteEntity(vo.CaptchaVo{Base64Captcha: image, CaptchaId: id}) } diff --git a/iothub/client/mqttclient/rpc.go b/iothub/client/mqttclient/rpc.go index 2c5b3f1..8fd6604 100644 --- a/iothub/client/mqttclient/rpc.go +++ b/iothub/client/mqttclient/rpc.go @@ -26,7 +26,7 @@ type RpcRequest struct { // RequestCmd 下发指令 func (rpc RpcRequest) RequestCmd(deviceId, rpcPayload string) error { topic := fmt.Sprintf(RpcReqTopic, rpc.RequestId) - value, ok := MqttClient.Load(deviceId) + value, ok := Session.Load(deviceId) if !ok { return errors.New("为获取到设备的MQTT连接") } @@ -35,7 +35,7 @@ func (rpc RpcRequest) RequestCmd(deviceId, rpcPayload string) error { func (rpc RpcRequest) Pub(deviceId, reqPayload string) error { topic := fmt.Sprintf(RpcRespTopic, rpc.RequestId) - value, ok := MqttClient.Load(deviceId) + value, ok := Session.Load(deviceId) if !ok { return errors.New("为获取到设备的MQTT连接") } diff --git a/pkg/rule_engine/instance.go b/pkg/rule_engine/instance.go index 7fa9373..b728aa3 100644 --- a/pkg/rule_engine/instance.go +++ b/pkg/rule_engine/instance.go @@ -38,23 +38,23 @@ func newInstanceWithManifest(m *manifest.Manifest) (*RuleChainInstance, error) { return nil, err } r := &RuleChainInstance{ - firstRuleNodeID: m.FirstRuleNodeID, + firstRuleNodeID: m.FirstRuleNodeId, nodes: nodes, } return r, nil } func (c *RuleChainInstance) StartRuleChain(ctx context.Context, msg *message.Message) error { - debugChan := make(chan *message.DebugMessage, 100) + debugChan := make(chan *message.DebugData, 100) endDebugChan := make(chan struct{}) go func() { for { select { case debugMsg := <-debugChan: - ruleChainDebugData.Add(c.ruleID, debugMsg.NodeID, debugMsg) + ruleChainDebugData.Add(c.ruleID, debugMsg.NodeId, *debugMsg) case <-endDebugChan: - logrus.Debugf("规则链%s,执行结束", msg.ID) + logrus.Debugf("规则链%s,执行结束", msg.Id) return } } @@ -68,4 +68,4 @@ func (c *RuleChainInstance) StartRuleChain(ctx context.Context, msg *message.Mes err := node.Handle(msg) endDebugChan <- struct{}{} return err -} \ No newline at end of file +}