diff --git a/internal/logic/domain/message/service/app_push.go b/internal/logic/domain/message/service/app_push.go index 533e843..d452e70 100644 --- a/internal/logic/domain/message/service/app_push.go +++ b/internal/logic/domain/message/service/app_push.go @@ -14,8 +14,8 @@ import ( func getChangeContent(args md3.PushParams, Content string) string { Content = strings.Replace(Content, "[MasterId]", args.MasterId, -1) - Content = strings.Replace(Content, "[消费发送者-会员昵称]", args.SendUserNickname, -1) - Content = strings.Replace(Content, "[消费发送者-会员头像]", args.SendUserAvatarUrl, -1) + Content = strings.Replace(Content, "[消息发送者-会员昵称]", args.SendUserNickname, -1) + Content = strings.Replace(Content, "[消息发送者-会员头像]", args.SendUserAvatarUrl, -1) Content = strings.Replace(Content, "[消息类型]", args.MessageType, -1) Content = strings.Replace(Content, "[备注]", args.Memo, -1) Content = strings.Replace(Content, "[时间]", args.Times, -1) @@ -57,7 +57,14 @@ func JgPush(args md3.PushParams) { //alia := db.DbUserPushForJg.UserPushForJgGetWithDb(args.MasterId, args.Uid) var aud = md2.PushAudience{Alias: []string{args.PushAlia}} var extras = map[string]interface{}{ - "extras": "拓展信息", + "master_id": args.MasterId, + "uid": args.SendUserNickname, + "push_type": args.PushType, + "message_type": args.MessageType, + "send_user_nickname": args.SendUserNickname, + "send_user_avatar_url": args.SendUserAvatarUrl, + "memo": args.Memo, + "times": args.Times, } var param = md2.PushParam{ Platform: "all", @@ -66,8 +73,10 @@ func JgPush(args md3.PushParams) { Content: args.Content, Extras: extras, } - send, _, err := jg_push.Send(jgPushAppKey, jgPushAppSecret, param) + send, res, err := jg_push.Send(jgPushAppKey, jgPushAppSecret, param) logger.Logger.Debug("JgPush_log", + zap.String("send", send), + zap.String("res", res), zap.String("push_alia", args.PushAlia), zap.String("title", param.Title), zap.String("content", param.Content), diff --git a/internal/logic/domain/message/service/message_service.go b/internal/logic/domain/message/service/message_service.go index ebdae6b..9dfa9a3 100644 --- a/internal/logic/domain/message/service/message_service.go +++ b/internal/logic/domain/message/service/message_service.go @@ -178,7 +178,7 @@ func (*messageService) SendToUser(ctx context.Context, sender *pb.Sender, toUser Uid: uid, PushAlia: alia, Title: "新消息提醒", - Content: "", + Content: "您收到一条新消息,来自会员[消息发送者-会员昵称],发送时间[时间],消息类型[消息类型],备注[备注]", PushType: "zhi_ying_gim", MessageType: req.MessageType.String(), SendUserNickname: sender.Nickname, diff --git a/internal/logic/domain/message/service/message_service_test.go b/internal/logic/domain/message/service/message_service_test.go index a6df9a7..b0141cb 100644 --- a/internal/logic/domain/message/service/message_service_test.go +++ b/internal/logic/domain/message/service/message_service_test.go @@ -3,6 +3,7 @@ package service import ( "context" "fmt" + md3 "gim/internal/logic/domain/message/md" "testing" jsoniter "github.com/json-iterator/go" @@ -38,3 +39,19 @@ func Test_messageService_Sync(t *testing.T) { fmt.Println(resp.HasMore) fmt.Println(len(resp.Messages)) } + +func Test_CommAddPush(t *testing.T) { + CommAddPush(md3.PushParams{ + MasterId: "123456", + Uid: "123", + PushAlia: "22255132_21702", + Title: "测试", + Content: "您收到一条新消息,来自会员[消息发送者-会员昵称],发送时间[时间],消息类型[消息类型],备注[备注]", + PushType: "gim", + MessageType: "text", + SendUserNickname: "fsahfjs", + SendUserAvatarUrl: "fafsd", + Memo: "fasf", + Times: "sadff", + }) +}