Skip to content

Commit

Permalink
fix: add condition
Browse files Browse the repository at this point in the history
  • Loading branch information
gly-hub committed Apr 18, 2024
1 parent a941446 commit e39f15f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion tools/rpccall/proto.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,10 @@ func SProtoCall(ctx *routing.Context, param interface{}, handler interface{}) er
}

rv := rt2.FieldByName("CommonResp").Elem()
if rv.FieldByName("Code").Int() != int64(0) {
if !rv.IsValid() {
return hc.Success(ctx, rets[0].Interface(), "")
}
if rv.FieldByName("Code").IsValid() && rv.FieldByName("Code").Int() != int64(0) {
return hc.Fail(ctx, &error_support.Error{Code: int(rv.FieldByName("Code").Int()), Msg: rv.FieldByName("Msg").String()})
}
return hc.Success(ctx, rets[0].Interface(), rv.FieldByName("Msg").String())
Expand Down

0 comments on commit e39f15f

Please sign in to comment.