|
@@ -159,7 +159,6 @@ func (*messageService) SendToUser(ctx context.Context, sender *pb.Sender, toUser |
|
|
if sender.DeviceId == devices[i].DeviceId { |
|
|
if sender.DeviceId == devices[i].DeviceId { |
|
|
continue |
|
|
continue |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
err = MessageService.SendToDevice(ctx, devices[i], &message) |
|
|
err = MessageService.SendToDevice(ctx, devices[i], &message) |
|
|
if err != nil { |
|
|
if err != nil { |
|
|
logger.Sugar.Error(err, zap.Any("SendToUser error", devices[i]), zap.Error(err)) |
|
|
logger.Sugar.Error(err, zap.Any("SendToUser error", devices[i]), zap.Error(err)) |
|
@@ -171,6 +170,10 @@ func (*messageService) SendToUser(ctx context.Context, sender *pb.Sender, toUser |
|
|
|
|
|
|
|
|
// SendToDevice 将消息发送给设备 |
|
|
// SendToDevice 将消息发送给设备 |
|
|
func (*messageService) SendToDevice(ctx context.Context, device *pb.Device, message *pb.Message) error { |
|
|
func (*messageService) SendToDevice(ctx context.Context, device *pb.Device, message *pb.Message) error { |
|
|
|
|
|
utils.FilePutContents("sendToDevice", utils.SerializeStr(map[string]interface{}{ |
|
|
|
|
|
"device": device, |
|
|
|
|
|
"message": message, |
|
|
|
|
|
})) |
|
|
messageSend := pb.MessageSend{Message: message} |
|
|
messageSend := pb.MessageSend{Message: message} |
|
|
_, err := rpc.GetConnectIntClient().DeliverMessage(picker.ContextWithAddr(ctx, device.ConnAddr), &pb.DeliverMessageReq{ |
|
|
_, err := rpc.GetConnectIntClient().DeliverMessage(picker.ContextWithAddr(ctx, device.ConnAddr), &pb.DeliverMessageReq{ |
|
|
DeviceId: device.DeviceId, |
|
|
DeviceId: device.DeviceId, |
|
|