@@ -8,8 +8,8 @@ type PushParams struct { | |||||
Content string `json:"content"` //内容 | Content string `json:"content"` //内容 | ||||
PushType string `json:"push_type"` //推送类型`zhi_ying_gim` | PushType string `json:"push_type"` //推送类型`zhi_ying_gim` | ||||
MessageType string `json:"message_type"` //消息类型`UNKNOWN、TEXT、FACE、VOICE、IMAGE、FILE、LOCATION、COMMAND、CUSTOM` | 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"` //备注 | Memo string `json:"memo"` //备注 | ||||
Times string `json:"times"` //时间 | Times string `json:"times"` //时间 | ||||
} | } |
@@ -59,6 +59,14 @@ func JgPush(args md3.PushParams) { | |||||
Extras: extras, | Extras: extras, | ||||
} | } | ||||
send, _, err := jg_push.Send(thirdJgPush["jg_push_app_key"], thirdJgPush["jg_push_app_secret"], param) | 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 { | if err != nil { | ||||
return | return | ||||
} | } | ||||
@@ -4,6 +4,7 @@ import ( | |||||
"context" | "context" | ||||
"gim/internal/business/comm/db" | "gim/internal/business/comm/db" | ||||
svc "gim/internal/business/comm/service" | svc "gim/internal/business/comm/service" | ||||
repo2 "gim/internal/business/domain/user/repo" | |||||
"gim/internal/logic/domain/message/md" | "gim/internal/logic/domain/message/md" | ||||
"gim/internal/logic/domain/message/model" | "gim/internal/logic/domain/message/model" | ||||
"gim/internal/logic/domain/message/repo" | "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") | 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) | uid := strconv.FormatInt(req.ReceiverId, 10) | ||||
alia := db.DbUserPushForJg.UserPushForJgGetWithDb(masterId, uid) | alia := db.DbUserPushForJg.UserPushForJgGetWithDb(masterId, uid) | ||||
if alia != "" { | 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`, 进行极光推送 | //TODO::接收者类型为`user`, 进行极光推送 | ||||
CommAddPush(md.PushParams{ | CommAddPush(md.PushParams{ | ||||
MasterId: masterId, | MasterId: masterId, | ||||