From 0f49d414585984c1e3a07d05c6811883670ffbc2 Mon Sep 17 00:00:00 2001 From: DengBiao <2319963317@qq.com> Date: Fri, 21 Apr 2023 17:18:02 +0800 Subject: [PATCH] update --- internal/logic/api/logic_ext_test.go | 16 ++++++++-------- internal/logic/app/group_app.go | 2 +- internal/logic/domain/group/model/group.go | 9 +++++---- 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/internal/logic/api/logic_ext_test.go b/internal/logic/api/logic_ext_test.go index dcd0fa7..fb65854 100644 --- a/internal/logic/api/logic_ext_test.go +++ b/internal/logic/api/logic_ext_test.go @@ -85,26 +85,26 @@ func TestLogicExtServer_SendMessage(t *testing.T) { func TestLogicExtServer_protoUnmarshal(t *testing.T) { db.InitMysql(config.MySQL) var msg model.Message - if err := db.DB.Table("message_000").Where("`id` = 10912").First(&msg).Error; err != nil { + if err := db.DB.Table("message_000").Where("`id` = 11414").First(&msg).Error; err != nil { if err == gorm.ErrRecordNotFound { fmt.Println(err) return } } - var temp pb.Command - var temp1 pb.UpdateGroupPush + var temp pb.RED_PACKAGE + //var temp1 pb.RED_PACKAGE err := proto.Unmarshal(msg.Content, &temp) if err != nil { fmt.Println(err) return } - err = proto.Unmarshal(temp.Data, &temp1) - if err != nil { - fmt.Println(err) - return - } + //err = proto.Unmarshal(temp.Data, &temp1) + //if err != nil { + // fmt.Println(err) + // return + //} fmt.Println(temp) fmt.Printf("!!!!") diff --git a/internal/logic/app/group_app.go b/internal/logic/app/group_app.go index a197459..a46c1df 100644 --- a/internal/logic/app/group_app.go +++ b/internal/logic/app/group_app.go @@ -117,7 +117,7 @@ func (*groupApp) AddMembers(ctx context.Context, userId, groupId int64, userIds return nil, err } - err = group.PushAddMember(ctx, userId, addedIds, true) + err = group.PushAddMember(ctx, userId, addedIds, false) if err != nil { return nil, err } diff --git a/internal/logic/domain/group/model/group.go b/internal/logic/domain/group/model/group.go index 6dc429e..9c9201a 100644 --- a/internal/logic/domain/group/model/group.go +++ b/internal/logic/domain/group/model/group.go @@ -258,10 +258,11 @@ func (g *Group) RecallSendMessage(ctx context.Context, sender *pb.Sender, req *p // SendRedPackage 发送红包消息发送至群组 func (g *Group) SendRedPackage(ctx context.Context, sender *pb.Sender, req *pb.SendRedPacketReq) (int64, error) { - if sender.SenderType == pb.SenderType_ST_USER && !g.IsMember(sender.SenderId) { - logger.Sugar.Error(ctx, sender.SenderId, req.ReceiverId, "不在群组内") - return 0, gerrors.ErrNotInGroup - } + //TODO::发送红包,暂不过滤群组用户 + //if sender.SenderType == pb.SenderType_ST_USER && !g.IsMember(sender.SenderId) { + // logger.Sugar.Error(ctx, sender.SenderId, req.ReceiverId, "不在群组内") + // return 0, gerrors.ErrNotInGroup + //} // 如果发送者是用户,将消息发送给发送者,获取用户seq var userSeq int64