From 998783d1d6ef5525d603dae46c8a3059888ef6de Mon Sep 17 00:00:00 2001 From: "huangsimin@fusen.cn" Date: Thu, 7 Dec 2023 15:52:05 +0800 Subject: [PATCH 1/2] update --- .../proto_build/tpls/http_grpc_method_var.tpl | 9 ------- service/auth.proto | 24 ++++++++++++------- 2 files changed, 15 insertions(+), 18 deletions(-) diff --git a/goutils/proto_build/tpls/http_grpc_method_var.tpl b/goutils/proto_build/tpls/http_grpc_method_var.tpl index ea98445..99914d6 100644 --- a/goutils/proto_build/tpls/http_grpc_method_var.tpl +++ b/goutils/proto_build/tpls/http_grpc_method_var.tpl @@ -1,17 +1,8 @@ package test import ( - "bytes" - "encoding/json" - "fmt" "{{.ProjectName}}/server/config" "fusen-basic/env" - "fusen-basic/utils/log" - "net/http" - "net/url" - "reflect" - "strings" - "time" ) var fusen *env.Fusen[config.Config] diff --git a/service/auth.proto b/service/auth.proto index ae10948..4198200 100644 --- a/service/auth.proto +++ b/service/auth.proto @@ -14,13 +14,7 @@ import "google/protobuf/any.proto"; service auth { // 登录接口 - rpc ValidToken(ValidTokenRequest) returns (ValidTokenResponse) { - // 添加 HTTP POST 网关注解 - option (google.api.http) = { - post: "/api/auth/valid/token" - body: "*" - }; - } + rpc ValidToken(ValidTokenRequest) returns (ValidTokenResponse) {} // 登录接口 rpc Login(UserLoginRequest) returns (UserLoginResponse) { @@ -121,6 +115,19 @@ service auth { } +message Debug { + int64 exp = 1; + int64 is_cache = 2; + int64 is_all_template_tag = 3; +} + +message UserInfo { + int64 user_id = 1; + int64 guest_id = 2; + int64 exp = 3; + Debug debug = 4; +} + // 验证token的请求 message ValidTokenRequest { optional string user_token = 1; @@ -130,8 +137,7 @@ message ValidTokenRequest { // 验证token的请求 message ValidTokenResponse { - google.protobuf.Struct user_info = 1; - google.protobuf.Struct debug_info = 2; + UserInfo user_info = 1; } From 61c10dab237d619793ed02b6f29f2da7e9f57e76 Mon Sep 17 00:00:00 2001 From: "huangsimin@fusen.cn" Date: Thu, 7 Dec 2023 16:20:19 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dstream=E4=B8=AD=E7=9A=84?= =?UTF-8?q?=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- goutils/proto_build/main.go | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/goutils/proto_build/main.go b/goutils/proto_build/main.go index 87f296e..1c8bde7 100644 --- a/goutils/proto_build/main.go +++ b/goutils/proto_build/main.go @@ -1082,19 +1082,17 @@ func parseGoFile(filePath string) (ClientParams []*ClientParam) { } else if iface, ok := typeSpec.Type.(*ast.InterfaceType); ok { interfaceName := typeSpec.Name.Name - if len(iface.Methods.List) == 3 { - if len(iface.Methods.List[0].Names) == 1 && len(iface.Methods.List[1].Names) == 1 { - name0 := iface.Methods.List[0].Names[0].Name - name1 := iface.Methods.List[1].Names[0].Name - if name0 == "Send" && name1 == "CloseAndRecv" { - // log.Println(name0, name1) - if getTypeString(iface.Methods.List[2].Type) == "grpc.ClientStream" { - // MethodType = "stream" - // log.Println(interfaceName) + if len(iface.Methods.List) >= 3 { + if len(iface.Methods.List[2].Names) == 0 { - continue - } + // log.Println(name0, name1) + if getTypeString(iface.Methods.List[2].Type) == "grpc.ClientStream" { + // MethodType = "stream" + // log.Println(interfaceName) + + continue } + } }