finclip-app-manager/application/grpc/externalApp.go

48 lines
1.6 KiB
Go
Raw Normal View History

2023-10-31 14:07:26 +08:00
package grpcHandler
import (
"context"
"finclip-app-manager/domain/entity/proto/apiproto"
"finclip-app-manager/domain/service"
pb "finclip-app-manager/infrastructure/protobuf/golang"
"gitlab.finogeeks.club/finclip-backend/apm"
)
func (GrpcServer) BatchAppsByIdentity(ctx context.Context, req *pb.BatchAppsByIdentityReq) (*pb.BatchAppsByIdentityRsp, error) {
span, ctx := apm.ApmClient().CreateGRpcEntrySpan(ctx, "GrpcServer.BatchAppsByIdentity")
defer span.End()
svr := service.NewAppService()
svrReq := &apiproto.BatchAppsByIdentityReq{
Source: req.Source,
IdentityType: req.IdentityType,
Apps: make([]apiproto.BatchAppsByIdentityAppsItem, 0),
}
for _, v := range req.Apps {
item := apiproto.BatchAppsByIdentityAppsItem{
AppId: v.GetAppId(),
Identity: v.GetIdentity(),
}
svrReq.Apps = append(svrReq.Apps, item)
}
return svr.BatchAppsByIdentity(ctx, req.GetSdkKey(), svrReq), nil
}
func (GrpcServer) IdentityAppsCheck(ctx context.Context, req *pb.IdentityAppsCheckReq) (*pb.IdentityAppsCheckRsp, error) {
span, ctx := apm.ApmClient().CreateGRpcEntrySpan(ctx, "GrpcServer.IdentityAppsCheck")
defer span.End()
svr := service.NewAppService()
svrReq := &apiproto.IdentityAppsCheckReq{
Source: req.Source,
IdentityType: req.IdentityType,
Apps: make([]apiproto.IdentityAppsCheckAppsItem, 0),
}
for _, v := range req.Apps {
item := apiproto.IdentityAppsCheckAppsItem{
AppId: v.GetAppId(),
Identity: v.GetIdentity(),
}
svrReq.Apps = append(svrReq.Apps, item)
}
return svr.IdentityAppsCheck(ctx, req.GetSdkKey(), svrReq), nil
}