|
@@ -2,7 +2,6 @@ package main
|
|
|
|
|
|
import (
|
|
import (
|
|
"context"
|
|
"context"
|
|
- "fmt"
|
|
|
|
"github.com/gogf/gf/encoding/gjson"
|
|
"github.com/gogf/gf/encoding/gjson"
|
|
"sparrow/pkg/klink"
|
|
"sparrow/pkg/klink"
|
|
"sparrow/pkg/models"
|
|
"sparrow/pkg/models"
|
|
@@ -133,21 +132,21 @@ func (mp *MQTTProvider) OnDeviceMessage(deviceid, vendorId string, msgtype strin
|
|
}
|
|
}
|
|
|
|
|
|
func processReportStatus(deviceid, vendorId string, message *gjson.Json) {
|
|
func processReportStatus(deviceid, vendorId string, message *gjson.Json) {
|
|
- fmt.Printf("deviceId-------------------:%v", deviceid)
|
|
|
|
|
|
+
|
|
device := &models.Device{}
|
|
device := &models.Device{}
|
|
err := server.RPCCallByName(nil, rpcs.RegistryServerName, "Registry.FindDeviceByIdentifier", deviceid, device)
|
|
err := server.RPCCallByName(nil, rpcs.RegistryServerName, "Registry.FindDeviceByIdentifier", deviceid, device)
|
|
if err != nil {
|
|
if err != nil {
|
|
server.Log.Errorf("device not found %s", deviceid)
|
|
server.Log.Errorf("device not found %s", deviceid)
|
|
return
|
|
return
|
|
}
|
|
}
|
|
- fmt.Printf("device-------------------:%v", device)
|
|
|
|
|
|
+
|
|
product := &models.Product{}
|
|
product := &models.Product{}
|
|
err = server.RPCCallByName(nil, rpcs.RegistryServerName, "Registry.FindProduct", device.ProductID, product)
|
|
err = server.RPCCallByName(nil, rpcs.RegistryServerName, "Registry.FindProduct", device.ProductID, product)
|
|
if err != nil {
|
|
if err != nil {
|
|
server.Log.Errorf("find product error : %v", err)
|
|
server.Log.Errorf("find product error : %v", err)
|
|
return
|
|
return
|
|
}
|
|
}
|
|
- fmt.Printf("product-------------------:%v", product)
|
|
|
|
|
|
+
|
|
reply := rpcs.ReplyOnStatus{}
|
|
reply := rpcs.ReplyOnStatus{}
|
|
args := rpcs.ArgsOnStatus{
|
|
args := rpcs.ArgsOnStatus{
|
|
DeviceId: deviceid,
|
|
DeviceId: deviceid,
|