feat : 取消rpc
continuous-integration/drone/push Build is failing Details

master
liuhaotian 2022-01-14 20:05:39 +08:00
parent b121129b30
commit 4b2e061919
1 changed files with 20 additions and 25 deletions

View File

@ -1,19 +1,14 @@
package handler package handler
import ( import (
"context"
"fmt" "fmt"
"git.icechen.cn/monorepo/backend/app/brahma/api/murder/internal/error_process" "git.icechen.cn/monorepo/backend/app/brahma/api/murder/internal/error_process"
"git.icechen.cn/monorepo/backend/app/brahma/api/murder/internal/model" "git.icechen.cn/monorepo/backend/app/brahma/api/murder/internal/model"
"git.icechen.cn/monorepo/backend/app/brahma/api/murder/internal/service" "git.icechen.cn/monorepo/backend/app/brahma/api/murder/internal/service"
"git.icechen.cn/monorepo/backend/pkg/proto/brahma/murder"
"github.com/gofiber/fiber/v2" "github.com/gofiber/fiber/v2"
ctxLogger "github.com/luizsuper/ctxLoggers" ctxLogger "github.com/luizsuper/ctxLoggers"
"go.uber.org/zap" "go.uber.org/zap"
"google.golang.org/grpc"
"log"
"strconv" "strconv"
"time"
) )
func GetScriptsH(ctx *fiber.Ctx) error { func GetScriptsH(ctx *fiber.Ctx) error {
@ -81,23 +76,23 @@ func DeleteScriptsH(ctx *fiber.Ctx) error {
return ctx.JSON(success(nil)) return ctx.JSON(success(nil))
} }
func HelloWorld() error { //func HelloWorld() error {
// Set up a connection to the server. // // Set up a connection to the server.
conn, err := grpc.Dial("localhost:3000", grpc.WithInsecure(), grpc.WithBlock()) // conn, err := grpc.Dial("localhost:3000", grpc.WithInsecure(), grpc.WithBlock())
if err != nil { // if err != nil {
log.Fatalf("did not connect: %v", err) // log.Fatalf("did not connect: %v", err)
} // }
defer conn.Close() // defer conn.Close()
c := murder.NewHelloWorldClient(conn) // c := murder.NewHelloWorldClient(conn)
//
// Contact the server and print out its response. // // Contact the server and print out its response.
ctx, cancel := context.WithTimeout(context.Background(), time.Second) // ctx, cancel := context.WithTimeout(context.Background(), time.Second)
defer cancel() // defer cancel()
r, err := c.Login(ctx, &murder.HelloRequest{Code: "lht"}) // r, err := c.Login(ctx, &murder.HelloRequest{Code: "lht"})
//
if err != nil { // if err != nil {
log.Fatalf("could not greet: %v", err) // log.Fatalf("could not greet: %v", err)
} // }
log.Printf("Greeting: %s", r.Token) // log.Printf("Greeting: %s", r.Token)
return nil // return nil
} //}