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"
|
"google.golang.org/grpc/credentials/insecure"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Nacos builds a zrpc client whose dials resolve via discovery.Pick.
|
|
||||||
func Nacos(conf zrpc.RpcClientConf) zrpc.Client {
|
func Nacos(conf zrpc.RpcClientConf) zrpc.Client {
|
||||||
serviceName := conf.Target
|
serviceName := conf.Target
|
||||||
if serviceName == "" {
|
if serviceName == "" {
|
||||||
@@ -27,7 +26,6 @@ func Nacos(conf zrpc.RpcClientConf) zrpc.Client {
|
|||||||
return zrpc.MustNewClient(cliConf,
|
return zrpc.MustNewClient(cliConf,
|
||||||
zrpc.WithDialOption(grpc.WithTransportCredentials(insecure.NewCredentials())),
|
zrpc.WithDialOption(grpc.WithTransportCredentials(insecure.NewCredentials())),
|
||||||
zrpc.WithDialOption(grpc.WithUnaryInterceptor(response.UserClientInterceptor)),
|
zrpc.WithDialOption(grpc.WithUnaryInterceptor(response.UserClientInterceptor)),
|
||||||
// 等重连/重新 Pick
|
|
||||||
zrpc.WithDialOption(grpc.WithDefaultCallOptions(grpc.WaitForReady(true))),
|
zrpc.WithDialOption(grpc.WithDefaultCallOptions(grpc.WaitForReady(true))),
|
||||||
zrpc.WithDialOption(grpc.WithConnectParams(grpc.ConnectParams{
|
zrpc.WithDialOption(grpc.WithConnectParams(grpc.ConnectParams{
|
||||||
MinConnectTimeout: 2 * time.Second,
|
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 {
|
func unwrapJSONData(v any) any {
|
||||||
s, ok := v.(string)
|
s, ok := v.(string)
|
||||||
if !ok {
|
if !ok {
|
||||||
|
|||||||
@@ -10,19 +10,15 @@ import (
|
|||||||
|
|
||||||
type BaseController struct{}
|
type BaseController struct{}
|
||||||
|
|
||||||
// Fail 基础错误的输出结果
|
|
||||||
func (b *BaseController) Fail(w http.ResponseWriter) {
|
func (b *BaseController) Fail(w http.ResponseWriter) {
|
||||||
b.Out(w, nil, Fail)
|
b.Out(w, nil, Fail)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Error 错误的输出结果
|
|
||||||
func (b *BaseController) Error(w http.ResponseWriter, cm Error) {
|
func (b *BaseController) Error(w http.ResponseWriter, cm Error) {
|
||||||
b.Out(w, nil, cm)
|
b.Out(w, nil, cm)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Out 输出结果
|
|
||||||
func (b *BaseController) Out(w http.ResponseWriter, data any, cm Error) {
|
func (b *BaseController) Out(w http.ResponseWriter, data any, cm Error) {
|
||||||
// 复制一份,避免并发请求改到包级 OK/Fail 单例
|
|
||||||
out := NewError(cm.GetCode(), cm.GetMsg()).WithData(data)
|
out := NewError(cm.GetCode(), cm.GetMsg()).WithData(data)
|
||||||
|
|
||||||
w.Header().Set("Content-Type", "application/json; charset=utf-8")
|
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)
|
out := NewError(int(code), msg).WithData(data)
|
||||||
|
|
||||||
w.Header().Set("Content-Type", "application/json; charset=utf-8")
|
w.Header().Set("Content-Type", "application/json; charset=utf-8")
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ const (
|
|||||||
applyMd5Key = "keys:"
|
applyMd5Key = "keys:"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Data Redis 中的编辑申请状态
|
|
||||||
type Data struct {
|
type Data struct {
|
||||||
Uid int `json:"uid"`
|
Uid int `json:"uid"`
|
||||||
Id int `json:"id"`
|
Id int `json:"id"`
|
||||||
@@ -38,7 +37,6 @@ func md5MapKey(md5 string) string {
|
|||||||
return applyProductEditKey + applyMd5Key + md5
|
return applyProductEditKey + applyMd5Key + md5
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get 读取申请状态
|
|
||||||
func Get(ctx context.Context, uId, objId int) (Data, error) {
|
func Get(ctx context.Context, uId, objId int) (Data, error) {
|
||||||
var data Data
|
var data Data
|
||||||
if redis.Client == nil {
|
if redis.Client == nil {
|
||||||
|
|||||||
@@ -55,7 +55,6 @@ func resolveStatus(reqStatus uint32, current uint8) uint8 {
|
|||||||
return dao.StatusEnabled
|
return dao.StatusEnabled
|
||||||
}
|
}
|
||||||
|
|
||||||
// buildAgentsJSON 按 agents 表主键 id 查出应用,落库为 [{id,agent_id,name}]
|
|
||||||
func buildAgentsJSON(ids []int64) (string, error) {
|
func buildAgentsJSON(ids []int64) (string, error) {
|
||||||
ids = cleanAgentIds(ids)
|
ids = cleanAgentIds(ids)
|
||||||
if len(ids) == 0 {
|
if len(ids) == 0 {
|
||||||
|
|||||||
Reference in New Issue
Block a user