DengBiao 1 rok temu
rodzic
commit
41d8365783
2 zmienionych plików z 20 dodań i 3 usunięć
  1. +11
    -2
      internal/logic/api/logic_ext_test.go
  2. +9
    -1
      internal/logic/app/group_app.go

+ 11
- 2
internal/logic/api/logic_ext_test.go Wyświetl plik

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



+ 9
- 1
internal/logic/app/group_app.go Wyświetl plik

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



Ładowanie…
Anuluj
Zapisz