diff --git a/internal/logic/domain/message/md/push.go b/internal/logic/domain/message/md/push.go index 79f26f9..6ef7606 100644 --- a/internal/logic/domain/message/md/push.go +++ b/internal/logic/domain/message/md/push.go @@ -8,8 +8,8 @@ type PushParams struct { Content string `json:"content"` //内容 PushType string `json:"push_type"` //推送类型`zhi_ying_gim` MessageType string `json:"message_type"` //消息类型`UNKNOWN、TEXT、FACE、VOICE、IMAGE、FILE、LOCATION、COMMAND、CUSTOM` - SendUserNickname string `json:"send_user_nickname"` //消费发送者-会员昵称 - SendUserAvatarUrl string `json:"send_user_avatar_url"` //消费发送者-会员头像 + SendUserNickname string `json:"send_user_nickname"` //消息发送者-会员昵称 + SendUserAvatarUrl string `json:"send_user_avatar_url"` //消息发送者-会员头像 Memo string `json:"memo"` //备注 Times string `json:"times"` //时间 } diff --git a/internal/logic/domain/message/service/app_push.go b/internal/logic/domain/message/service/app_push.go index 034e4ed..e10c37e 100644 --- a/internal/logic/domain/message/service/app_push.go +++ b/internal/logic/domain/message/service/app_push.go @@ -59,6 +59,14 @@ func JgPush(args md3.PushParams) { Extras: extras, } send, _, err := jg_push.Send(thirdJgPush["jg_push_app_key"], thirdJgPush["jg_push_app_secret"], param) + logger.Logger.Debug("JgPush", + zap.String("push_alia", args.PushAlia), + zap.String("title", param.Title), + zap.String("content", param.Content), + zap.String("jg_push_app_key", thirdJgPush["jg_push_app_key"]), + zap.String("jg_push_app_secret", thirdJgPush["jg_push_app_secret"]), + zap.String("err", err.Error()), + ) if err != nil { return } diff --git a/internal/logic/domain/message/service/message_service.go b/internal/logic/domain/message/service/message_service.go index ef4d11d..55c3a95 100644 --- a/internal/logic/domain/message/service/message_service.go +++ b/internal/logic/domain/message/service/message_service.go @@ -4,6 +4,7 @@ import ( "context" "gim/internal/business/comm/db" svc "gim/internal/business/comm/service" + repo2 "gim/internal/business/domain/user/repo" "gim/internal/logic/domain/message/md" "gim/internal/logic/domain/message/model" "gim/internal/logic/domain/message/repo" @@ -158,10 +159,19 @@ func (*messageService) SendToUser(ctx context.Context, sender *pb.Sender, toUser } isOpenAppPush := svc.SysCfgGet(masterId, "is_open_app_push") - if req.ReceiverType == 1 && isOpenAppPush == "1" { + if sender.SenderType == 1 && req.ReceiverType == 1 && isOpenAppPush == "1" { uid := strconv.FormatInt(req.ReceiverId, 10) alia := db.DbUserPushForJg.UserPushForJgGetWithDb(masterId, uid) if alia != "" { + if sender.Nickname == "" { + sendUser, err := repo2.UserRepo.Get(sender.SenderId) + if err != nil { + logger.Sugar.Error(err) + return 0, err + } + sender.Nickname = sendUser.Nickname + sender.AvatarUrl = sendUser.AvatarUrl + } //TODO::接收者类型为`user`, 进行极光推送 CommAddPush(md.PushParams{ MasterId: masterId,