knowledgeinfologic.go 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. package logic
  2. import (
  3. "bp.jydev.jianyu360.cn/SocialPlatform/knowledgeBase/rpc/knowledge/knowledgeclient"
  4. "context"
  5. "github.com/zeromicro/go-zero/core/logx"
  6. "bp.jydev.jianyu360.cn/SocialPlatform/knowledgeBase/api/knowledge/internal/svc"
  7. "bp.jydev.jianyu360.cn/SocialPlatform/knowledgeBase/api/knowledge/internal/types"
  8. )
  9. type KnowledgeInfoLogic struct {
  10. logx.Logger
  11. ctx context.Context
  12. svcCtx *svc.ServiceContext
  13. }
  14. func NewKnowledgeInfoLogic(ctx context.Context, svcCtx *svc.ServiceContext) KnowledgeInfoLogic {
  15. return KnowledgeInfoLogic{
  16. Logger: logx.WithContext(ctx),
  17. ctx: ctx,
  18. svcCtx: svcCtx,
  19. }
  20. }
  21. func (l *KnowledgeInfoLogic) KnowledgeInfo(req types.InfoReq) (*types.CommonRes, error) {
  22. // todo: add your logic here and delete this line
  23. resp, err := l.svcCtx.Knowledge.KnowledgeInfo(l.ctx, &knowledgeclient.KnowledgeEntity{
  24. AnswerId: req.AnswerId,
  25. })
  26. if err != nil {
  27. return nil, err
  28. }
  29. return &types.CommonRes{
  30. Error_code: int(resp.ErrorCode),
  31. Error_msg: resp.ErrorMsg,
  32. Data: resp.Data,
  33. }, nil
  34. }