commonphrasesdellogic.go 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738
  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 CommonPhrasesDelLogic struct {
  10. logx.Logger
  11. ctx context.Context
  12. svcCtx *svc.ServiceContext
  13. }
  14. func NewCommonPhrasesDelLogic(ctx context.Context, svcCtx *svc.ServiceContext) CommonPhrasesDelLogic {
  15. return CommonPhrasesDelLogic{
  16. Logger: logx.WithContext(ctx),
  17. ctx: ctx,
  18. svcCtx: svcCtx,
  19. }
  20. }
  21. func (l *CommonPhrasesDelLogic) CommonPhrasesDel(req types.CommonPhrasesInfoOrDelReq) (*types.CommonRes, error) {
  22. resp, err := l.svcCtx.Knowledge.CommonPhrasesDel(l.ctx, &knowledgeclient.CommonPhrasesInfoReq{
  23. Id: req.Id,
  24. })
  25. if err != nil {
  26. return nil, err
  27. }
  28. return &types.CommonRes{
  29. Error_code: int(resp.ErrorCode),
  30. Error_msg: resp.ErrorMsg,
  31. Data: resp.Data,
  32. }, nil
  33. }