commonphrasequerylogic.go 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. package logic
  2. import (
  3. . "bp.jydev.jianyu360.cn/SocialPlatform/knowledgeBase/rpc/knowledge/init"
  4. "bp.jydev.jianyu360.cn/SocialPlatform/knowledgeBase/rpc/knowledge/internal/service"
  5. "bp.jydev.jianyu360.cn/SocialPlatform/knowledgeBase/rpc/knowledge/knowledge"
  6. "context"
  7. "fmt"
  8. "github.com/zeromicro/go-zero/core/logx"
  9. "bp.jydev.jianyu360.cn/SocialPlatform/knowledgeBase/rpc/knowledge/internal/svc"
  10. )
  11. type CommonPhraseQueryLogic struct {
  12. ctx context.Context
  13. svcCtx *svc.ServiceContext
  14. logx.Logger
  15. }
  16. func NewCommonPhraseQueryLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CommonPhraseQueryLogic {
  17. return &CommonPhraseQueryLogic{
  18. ctx: ctx,
  19. svcCtx: svcCtx,
  20. Logger: logx.WithContext(ctx),
  21. }
  22. }
  23. // 客服输入文字,匹配话术
  24. func (l *CommonPhraseQueryLogic) CommonPhraseQuery(in *knowledge.CommonPhraseQueryReq) (*knowledge.CommonPhraseQueryResp, error) {
  25. // todo: add your logic here and delete this line
  26. var result = &knowledge.CommonPhraseQueryResp{}
  27. c := service.CommonPhrasesService{}
  28. contents := c.CommonPhraseQuery(in, C.Segment, C.FindCount)
  29. result.ErrorCode = 0
  30. result.ErrorMsg = "请求成功"
  31. result.Data = contents
  32. fmt.Println("推荐话术", result)
  33. return result, nil
  34. }