keywordlistlogic.go 984 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. package logic
  2. import (
  3. "bp.jydev.jianyu360.cn/SocialPlatform/knowledgeBase/rpc/knowledge/knowledge"
  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.KeywordListReq) (resp *types.CommonRes, err error) {
  22. res, rErr := l.svcCtx.Knowledge.KeywordList(l.ctx, &knowledge.KeywordListReq{
  23. AppId: req.AppId,
  24. })
  25. if rErr != nil {
  26. return nil, rErr
  27. }
  28. return &types.CommonRes{
  29. Error_code: int(res.ErrorCode),
  30. Error_msg: res.ErrorMsg,
  31. Data: res.Data,
  32. }, nil
  33. }