|
|
@@ -159,7 +159,6 @@ func (*messageService) SendToUser(ctx context.Context, sender *pb.Sender, toUser |
|
|
|
if sender.DeviceId == devices[i].DeviceId { |
|
|
|
continue |
|
|
|
} |
|
|
|
|
|
|
|
err = MessageService.SendToDevice(ctx, devices[i], &message) |
|
|
|
if err != nil { |
|
|
|
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 将消息发送给设备 |
|
|
|
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} |
|
|
|
_, err := rpc.GetConnectIntClient().DeliverMessage(picker.ContextWithAddr(ctx, device.ConnAddr), &pb.DeliverMessageReq{ |
|
|
|
DeviceId: device.DeviceId, |
|
|
|