Browse Source

update

master
DengBiao 2 years ago
parent
commit
276fe833e9
3 changed files with 21 additions and 3 deletions
  1. +2
    -2
      internal/logic/domain/message/md/push.go
  2. +8
    -0
      internal/logic/domain/message/service/app_push.go
  3. +11
    -1
      internal/logic/domain/message/service/message_service.go

+ 2
- 2
internal/logic/domain/message/md/push.go View File

@@ -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"` //时间
}

+ 8
- 0
internal/logic/domain/message/service/app_push.go View File

@@ -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
}


+ 11
- 1
internal/logic/domain/message/service/message_service.go View File

@@ -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,


Loading…
Cancel
Save