fix: wecom user agent
CI / changes (push) Successful in 12s
CI / ad (push) Successful in 1s
CI / admin (push) Successful in 0s
CI / bff (push) Failing after 25s
CI / chore (push) Successful in 1s
CI / express (push) Successful in 0s
CI / product (push) Successful in 27s
CI / sale (push) Successful in 0s
CI / user (push) Successful in 0s
CI / wecom (push) Successful in 25s
CI / changes (push) Successful in 12s
CI / ad (push) Successful in 1s
CI / admin (push) Successful in 0s
CI / bff (push) Failing after 25s
CI / chore (push) Successful in 1s
CI / express (push) Successful in 0s
CI / product (push) Successful in 27s
CI / sale (push) Successful in 0s
CI / user (push) Successful in 0s
CI / wecom (push) Successful in 25s
This commit is contained in:
@@ -13,7 +13,6 @@ import (
|
||||
"google.golang.org/grpc/credentials/insecure"
|
||||
)
|
||||
|
||||
// Nacos builds a zrpc client whose dials resolve via discovery.Pick.
|
||||
func Nacos(conf zrpc.RpcClientConf) zrpc.Client {
|
||||
serviceName := conf.Target
|
||||
if serviceName == "" {
|
||||
@@ -27,7 +26,6 @@ func Nacos(conf zrpc.RpcClientConf) zrpc.Client {
|
||||
return zrpc.MustNewClient(cliConf,
|
||||
zrpc.WithDialOption(grpc.WithTransportCredentials(insecure.NewCredentials())),
|
||||
zrpc.WithDialOption(grpc.WithUnaryInterceptor(response.UserClientInterceptor)),
|
||||
// 等重连/重新 Pick
|
||||
zrpc.WithDialOption(grpc.WithDefaultCallOptions(grpc.WaitForReady(true))),
|
||||
zrpc.WithDialOption(grpc.WithConnectParams(grpc.ConnectParams{
|
||||
MinConnectTimeout: 2 * time.Second,
|
||||
|
||||
@@ -52,7 +52,6 @@ func Wrap(next http.HandlerFunc) http.HandlerFunc {
|
||||
}
|
||||
}
|
||||
|
||||
// unwrapJSONData 将 RPC Response.data(proto string)里的 JSON 文本还原为对象/数组/数字。
|
||||
func unwrapJSONData(v any) any {
|
||||
s, ok := v.(string)
|
||||
if !ok {
|
||||
|
||||
@@ -10,19 +10,15 @@ import (
|
||||
|
||||
type BaseController struct{}
|
||||
|
||||
// Fail 基础错误的输出结果
|
||||
func (b *BaseController) Fail(w http.ResponseWriter) {
|
||||
b.Out(w, nil, Fail)
|
||||
}
|
||||
|
||||
// Error 错误的输出结果
|
||||
func (b *BaseController) Error(w http.ResponseWriter, cm Error) {
|
||||
b.Out(w, nil, cm)
|
||||
}
|
||||
|
||||
// Out 输出结果
|
||||
func (b *BaseController) Out(w http.ResponseWriter, data any, cm Error) {
|
||||
// 复制一份,避免并发请求改到包级 OK/Fail 单例
|
||||
out := NewError(cm.GetCode(), cm.GetMsg()).WithData(data)
|
||||
|
||||
w.Header().Set("Content-Type", "application/json; charset=utf-8")
|
||||
@@ -51,7 +47,6 @@ func (b *BaseController) OutPut(w http.ResponseWriter, code int32, data any, msg
|
||||
}
|
||||
}
|
||||
|
||||
// 复制一份,避免并发请求改到包级 OK/Fail 单例
|
||||
out := NewError(int(code), msg).WithData(data)
|
||||
|
||||
w.Header().Set("Content-Type", "application/json; charset=utf-8")
|
||||
|
||||
Reference in New Issue
Block a user