diff --git a/internal/logic/api/logic_ext_test.go b/internal/logic/api/logic_ext_test.go index 2832a20..d096959 100644 --- a/internal/logic/api/logic_ext_test.go +++ b/internal/logic/api/logic_ext_test.go @@ -85,19 +85,28 @@ 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` = 4145").First(&msg).Error; err != nil { + if err := db.DB.Table("message_000").Where("`id` = 192914").First(&msg).Error; err != nil { if err == gorm.ErrRecordNotFound { fmt.Println(err) return } } - var temp pb.RED_PACKAGE + var temp pb.Command + var temp1 pb.AddGroupMembersPush 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 + } + + fmt.Println(temp) fmt.Printf("!!!!") } diff --git a/internal/logic/app/group_app.go b/internal/logic/app/group_app.go index 46bb534..6defd3d 100644 --- a/internal/logic/app/group_app.go +++ b/internal/logic/app/group_app.go @@ -38,7 +38,15 @@ func (*groupApp) GetGroup(ctx context.Context, groupId int64) (*pb.Group, error) if err != nil { return nil, err } - + userId, _, err := grpclib.GetCtxData(ctx) + if err != nil { + return nil, err + } + for _, member := range group.Members { + if member.UserId == userId && member.MemberType != int(pb.MemberType_GMT_ADMIN) { + group.Name = "我的推荐人群" + } + } return group.ToProto(), nil }