34 lines
921 B
Go
34 lines
921 B
Go
package query
|
|
|
|
import (
|
|
"context"
|
|
"ycc-server/app/main/api/internal/svc"
|
|
"ycc-server/app/main/api/internal/types"
|
|
|
|
"github.com/zeromicro/go-zero/core/logx"
|
|
)
|
|
|
|
type QueryServiceAgentLogic struct {
|
|
logx.Logger
|
|
ctx context.Context
|
|
svcCtx *svc.ServiceContext
|
|
}
|
|
|
|
func NewQueryServiceAgentLogic(ctx context.Context, svcCtx *svc.ServiceContext) *QueryServiceAgentLogic {
|
|
return &QueryServiceAgentLogic{
|
|
Logger: logx.WithContext(ctx),
|
|
ctx: ctx,
|
|
svcCtx: svcCtx,
|
|
}
|
|
}
|
|
|
|
func (l *QueryServiceAgentLogic) QueryServiceAgent(req *types.QueryServiceReq) (resp *types.QueryServiceResp, err error) {
|
|
if req.AgentIdentifier != "" {
|
|
l.ctx = context.WithValue(l.ctx, "agentIdentifier", req.AgentIdentifier)
|
|
} else if req.App {
|
|
l.ctx = context.WithValue(l.ctx, "app", req.App)
|
|
}
|
|
proxy := NewQueryServiceLogic(l.ctx, l.svcCtx)
|
|
return proxy.PreprocessLogic(req, req.Product)
|
|
}
|