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