This commit is contained in:
wangchuxiao
2023-05-11 20:02:21 +08:00
parent 52b079a582
commit 945b638d4d
4 changed files with 5 additions and 9 deletions
-3
View File
@@ -15,7 +15,6 @@ func Call[A, B, C any](
client func(ctx context.Context) (C, error),
c *gin.Context,
) {
log.ZDebug(c, "before bind")
var req A
if err := c.BindJSON(&req); err != nil {
log.ZWarn(c, "gin bind json error", err, "req", req)
@@ -29,14 +28,12 @@ func Call[A, B, C any](
return
}
}
log.ZDebug(c, "before get grpc conn")
cli, err := client(c)
if err != nil {
log.ZError(c, "get conn error", err, "req", req)
apiresp.GinError(c, errs.ErrInternalServer.Wrap(err.Error())) // 获取RPC连接失败
return
}
log.ZDebug(c, "before call rpc")
data, err := rpc(cli, c, &req)
if err != nil {
log.ZError(c, "rpc call error", err, "req", req)