瀏覽代碼

update

master
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",
})
}

Loading…
取消
儲存