DengBiao 2 лет назад
Родитель
Сommit
ca0aed6765
1 измененных файлов: 22 добавлений и 25 удалений
  1. +22
    -25
      internal/logic/domain/message/service/message_service.go

+ 22
- 25
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


Загрузка…
Отмена
Сохранить