diff --git a/internal/logic/domain/message/service/message_service.go b/internal/logic/domain/message/service/message_service.go index 96f1177..9b72b6c 100644 --- a/internal/logic/domain/message/service/message_service.go +++ b/internal/logic/domain/message/service/message_service.go @@ -157,32 +157,29 @@ func (*messageService) SendToUser(ctx context.Context, sender *pb.Sender, toUser return 0, err } - var isPush = false - for i := range devices { - if !isPush { - isOpenAppPush := svc.SysCfgGet(masterId, "is_open_app_push") - if req.ReceiverType == 1 && isOpenAppPush == "1" { - uid := strconv.FormatInt(req.ReceiverId, 10) - alia := db.DbUserPushForJg.UserPushForJgGetWithDb(masterId, uid) - if alia != "" { - //TODO::接收者类型为`user`, 进行极光推送 - CommAddPush(md.PushParams{ - MasterId: masterId, - Uid: uid, - PushAlia: "", - Title: "新消息提醒", - Content: "", - PushType: "zhi_ying_gim", - MessageType: req.MessageType.String(), - SendUserNickname: sender.Nickname, - SendUserAvatarUrl: sender.AvatarUrl, - Memo: sender.SenderType.String(), - Times: time.Now().Format("2006-01-02 15:04:05.000"), - }) - isPush = true - } - } + isOpenAppPush := svc.SysCfgGet(masterId, "is_open_app_push") + if req.ReceiverType == 1 && isOpenAppPush == "1" { + uid := strconv.FormatInt(req.ReceiverId, 10) + alia := db.DbUserPushForJg.UserPushForJgGetWithDb(masterId, uid) + if alia != "" { + //TODO::接收者类型为`user`, 进行极光推送 + CommAddPush(md.PushParams{ + MasterId: masterId, + Uid: uid, + PushAlia: "", + Title: "新消息提醒", + Content: "", + PushType: "zhi_ying_gim", + MessageType: req.MessageType.String(), + SendUserNickname: sender.Nickname, + SendUserAvatarUrl: sender.AvatarUrl, + Memo: sender.SenderType.String(), + Times: time.Now().Format("2006-01-02 15:04:05.000"), + }) } + } + + for i := range devices { if sender.DeviceId == devices[i].DeviceId { // 消息不需要投递给发送消息的设备 continue