1234567891011121314151617181920212223242526272829303132333435363738394041 |
- package logic
- import (
- "bp.jydev.jianyu360.cn/SocialPlatform/knowledgeBase/rpc/knowledge/knowledgeclient"
- "context"
- "github.com/zeromicro/go-zero/core/logx"
- "bp.jydev.jianyu360.cn/SocialPlatform/knowledgeBase/api/knowledge/internal/svc"
- "bp.jydev.jianyu360.cn/SocialPlatform/knowledgeBase/api/knowledge/internal/types"
- )
- type FindAnswerLogic struct {
- logx.Logger
- ctx context.Context
- svcCtx *svc.ServiceContext
- }
- func NewFindAnswerLogic(ctx context.Context, svcCtx *svc.ServiceContext) FindAnswerLogic {
- return FindAnswerLogic{
- Logger: logx.WithContext(ctx),
- ctx: ctx,
- svcCtx: svcCtx,
- }
- }
- func (l *FindAnswerLogic) FindAnswer(req types.FindAnswerReq) (*types.CommonRes, error) {
- // todo: add your logic here and delete this line
- resp, err := l.svcCtx.Knowledge.FindAnswer(l.ctx, &knowledgeclient.FindAnswerReq{
- Type: req.Type,
- RobotEntId: req.RobotEntId,
- Question: req.Question,
- })
- if err != nil {
- return nil, err
- }
- return &types.CommonRes{
- Error_code: int(resp.ErrorCode),
- Error_msg: resp.ErrorMsg,
- Data: resp.Data,
- }, nil
- }
|