keywordlistlogic.go 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. package logic
  2. import (
  3. "bp.jydev.jianyu360.cn/SocialPlatform/knowledgeBase/rpc/knowledge/knowledgeclient"
  4. "context"
  5. "bp.jydev.jianyu360.cn/SocialPlatform/knowledgeBase/api/knowledge/internal/svc"
  6. "bp.jydev.jianyu360.cn/SocialPlatform/knowledgeBase/api/knowledge/internal/types"
  7. "github.com/zeromicro/go-zero/core/logx"
  8. )
  9. type KeywordListLogic struct {
  10. logx.Logger
  11. ctx context.Context
  12. svcCtx *svc.ServiceContext
  13. }
  14. func NewKeywordListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *KeywordListLogic {
  15. return &KeywordListLogic{
  16. Logger: logx.WithContext(ctx),
  17. ctx: ctx,
  18. svcCtx: svcCtx,
  19. }
  20. }
  21. func (l *KeywordListLogic) KeywordList(req *types.CommonPhrasesQueryReq) (resp *types.CommonRes, err error) {
  22. res, rErr := l.svcCtx.Knowledge.KeywordList(l.ctx, &knowledgeclient.CommonPhraseQueryReq{
  23. Query: req.Query,
  24. EntId: req.EntId,
  25. AppId: req.AppId,
  26. })
  27. if rErr != nil {
  28. return nil, rErr
  29. }
  30. return &types.CommonRes{
  31. Error_code: int(res.ErrorCode),
  32. Error_msg: res.ErrorMsg,
  33. Data: res.Data,
  34. }, nil
  35. }