finclip-app-manager/infrastructure/client/grpc/mop_account_system.go

42 lines
921 B
Go

package grpc
import (
"context"
"errors"
"finclip-app-manager/infrastructure/config"
pb "finclip-app-manager/infrastructure/protobuf/golang"
)
func GetGroupInfoByGroupId(ctx context.Context, organId string) (*pb.GetBusinessInfoByIdRsp_DATA, error) {
var rsp *pb.GetBusinessInfoByIdRsp
var err error
for i := 0; i < 2; i++ {
conn, err1 := GetGrpcConnManager().GetConn(config.GetConfig().ConsulAddr, "mop-account-system", "tag="+config.GetConfig().ConsulTag)
if err1 != nil {
err = err1
continue
}
c := pb.NewMopAccountSystemClient(conn)
var req pb.GetBusinessInfoByIdReq
req.OrganTraceId = organId
rsp, err = c.GetBusinessInfoById(ctx, &req)
if err != nil {
log.Errorf("err=%s", err.Error())
continue
} else {
err = nil
break
}
}
if err != nil {
return nil, err
}
if rsp.Result.Httpcode != 200 {
return nil, errors.New(rsp.Result.Error)
}
return rsp.Data, nil
}