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

43 lines
897 B
Go
Raw Permalink Normal View History

2023-10-31 14:07:26 +08:00
package grpc
import (
"context"
"errors"
"finclip-app-manager/infrastructure/config"
pb "finclip-app-manager/infrastructure/protobuf/golang"
)
func GetSdkVerEncrypted(ctx context.Context, sdkVer string) (bool, error) {
var rsp *pb.QueryEncryptedRsp
var err error
for i := 0; i < 2; i++ {
conn, err1 := GetGrpcConnManager().GetConn(config.GetConfig().ConsulAddr, "mop-applet-build-manager", "tag="+config.GetConfig().ConsulTag)
if err1 != nil {
err = err1
continue
}
c := pb.NewMopAppletBuildMangerClient(conn)
var req pb.QueryEncryptedReq
req.SdkVersion = sdkVer
rsp, err = c.QueryEncrypted(ctx, &req)
if err != nil {
log.Errorf("err=%s", err.Error())
continue
} else {
err = nil
break
}
}
if err != nil {
return false, err
}
if rsp.Result.Httpcode != 200 {
return false, errors.New(rsp.Result.Error)
}
return rsp.Data.Encrypted, nil
}