38 lines
821 B
Go
38 lines
821 B
Go
package toolbox
|
|
|
|
import (
|
|
"context"
|
|
|
|
"tyc-server/app/main/api/internal/svc"
|
|
"tyc-server/app/main/api/internal/types"
|
|
|
|
"github.com/zeromicro/go-zero/core/logx"
|
|
)
|
|
|
|
type ToolboxQueryLogic struct {
|
|
logx.Logger
|
|
ctx context.Context
|
|
svcCtx *svc.ServiceContext
|
|
}
|
|
|
|
func NewToolboxQueryLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ToolboxQueryLogic {
|
|
return &ToolboxQueryLogic{
|
|
Logger: logx.WithContext(ctx),
|
|
ctx: ctx,
|
|
svcCtx: svcCtx,
|
|
}
|
|
}
|
|
|
|
func (l *ToolboxQueryLogic) ToolboxQuery(req *types.ToolboxQueryReq) (resp *types.ToolboxQueryResp, err error) {
|
|
// 调用toolboxService执行工具查询
|
|
result, err := l.svcCtx.ToolboxService.Query(l.ctx, req.ToolKey, req.Params)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return &types.ToolboxQueryResp{
|
|
ToolKey: req.ToolKey,
|
|
Result: result,
|
|
}, nil
|
|
}
|