From ce7aa18477e065ae90c61022f884fb9583e6bacb Mon Sep 17 00:00:00 2001 From: zzw <1464003642@qq.com> Date: Mon, 31 Aug 2026 15:22:44 +0800 Subject: [PATCH] fix: wecom user agent --- bff/internal/dialer/nacos.go | 2 -- bff/internal/response/middleware.go | 1 - bff/internal/response/response.go | 5 ----- services/product/internal/apply/apply.go | 2 -- services/wecom/internal/logic/helper.go | 1 - 5 files changed, 11 deletions(-) diff --git a/bff/internal/dialer/nacos.go b/bff/internal/dialer/nacos.go index d0452d2..49c583b 100644 --- a/bff/internal/dialer/nacos.go +++ b/bff/internal/dialer/nacos.go @@ -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, diff --git a/bff/internal/response/middleware.go b/bff/internal/response/middleware.go index 65a405d..464f6e0 100644 --- a/bff/internal/response/middleware.go +++ b/bff/internal/response/middleware.go @@ -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 { diff --git a/bff/internal/response/response.go b/bff/internal/response/response.go index 40ab7b4..f1ad1be 100644 --- a/bff/internal/response/response.go +++ b/bff/internal/response/response.go @@ -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") diff --git a/services/product/internal/apply/apply.go b/services/product/internal/apply/apply.go index 69e3948..4da1f34 100644 --- a/services/product/internal/apply/apply.go +++ b/services/product/internal/apply/apply.go @@ -20,7 +20,6 @@ const ( applyMd5Key = "keys:" ) -// Data Redis 中的编辑申请状态 type Data struct { Uid int `json:"uid"` Id int `json:"id"` @@ -38,7 +37,6 @@ func md5MapKey(md5 string) string { return applyProductEditKey + applyMd5Key + md5 } -// Get 读取申请状态 func Get(ctx context.Context, uId, objId int) (Data, error) { var data Data if redis.Client == nil { diff --git a/services/wecom/internal/logic/helper.go b/services/wecom/internal/logic/helper.go index e15780d..e0f4ef1 100644 --- a/services/wecom/internal/logic/helper.go +++ b/services/wecom/internal/logic/helper.go @@ -55,7 +55,6 @@ func resolveStatus(reqStatus uint32, current uint8) uint8 { return dao.StatusEnabled } -// buildAgentsJSON 按 agents 表主键 id 查出应用,落库为 [{id,agent_id,name}] func buildAgentsJSON(ids []int64) (string, error) { ids = cleanAgentIds(ids) if len(ids) == 0 {