DengBiao преди 2 години
родител
ревизия
e2c966f542
променени са 3 файла, в които са добавени 31 реда и са изтрити 5 реда
  1. +13
    -4
      internal/logic/domain/message/service/app_push.go
  2. +1
    -1
      internal/logic/domain/message/service/message_service.go
  3. +17
    -0
      internal/logic/domain/message/service/message_service_test.go

+ 13
- 4
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),


+ 1
- 1
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,


+ 17
- 0
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",
})
}

Зареждане…
Отказ
Запис