knowledgedellogic.go 1007 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. package logic
  2. import (
  3. "bp.jydev.jianyu360.cn/SocialPlatform/knowledgeBase/rpc/knowledge/knowledge"
  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 KnowledgeDelLogic struct {
  10. logx.Logger
  11. ctx context.Context
  12. svcCtx *svc.ServiceContext
  13. }
  14. func NewKnowledgeDelLogic(ctx context.Context, svcCtx *svc.ServiceContext) KnowledgeDelLogic {
  15. return KnowledgeDelLogic{
  16. Logger: logx.WithContext(ctx),
  17. ctx: ctx,
  18. svcCtx: svcCtx,
  19. }
  20. }
  21. func (l *KnowledgeDelLogic) KnowledgeDel(req types.DeleteReq) (*types.CommonRes, error) {
  22. // todo: add your logic here and delete this line
  23. resp, err := l.svcCtx.Knowledge.KnowledgeDel(l.ctx, &knowledge.KnowledgeDelReq{
  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. }, nil
  33. }