Browse Source

update

master
DengBiao 1 year ago
parent
commit
0f49d41458
3 changed files with 14 additions and 13 deletions
  1. +8
    -8
      internal/logic/api/logic_ext_test.go
  2. +1
    -1
      internal/logic/app/group_app.go
  3. +5
    -4
      internal/logic/domain/group/model/group.go

+ 8
- 8
internal/logic/api/logic_ext_test.go View File

@@ -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("!!!!")


+ 1
- 1
internal/logic/app/group_app.go View File

@@ -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
}


+ 5
- 4
internal/logic/domain/group/model/group.go View File

@@ -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


Loading…
Cancel
Save