commonphrasesaddlogic.go 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. package logic
  2. import (
  3. "bp.jydev.jianyu360.cn/SocialPlatform/knowledgeBase/rpc/knowledge/internal/service"
  4. "bp.jydev.jianyu360.cn/SocialPlatform/knowledgeBase/rpc/knowledge/knowledgeclient"
  5. "context"
  6. "github.com/zeromicro/go-zero/core/logx"
  7. "bp.jydev.jianyu360.cn/SocialPlatform/knowledgeBase/rpc/knowledge/internal/svc"
  8. )
  9. type CommonPhrasesAddLogic struct {
  10. ctx context.Context
  11. svcCtx *svc.ServiceContext
  12. logx.Logger
  13. }
  14. func NewCommonPhrasesAddLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CommonPhrasesAddLogic {
  15. return &CommonPhrasesAddLogic{
  16. ctx: ctx,
  17. svcCtx: svcCtx,
  18. Logger: logx.WithContext(ctx),
  19. }
  20. }
  21. // CommonPhrasesAdd 客服话术添加、编辑
  22. func (l *CommonPhrasesAddLogic) CommonPhrasesAdd(in *knowledgeclient.CommonPhrasesAddReq) (*knowledgeclient.AddResponse, error) {
  23. result := &knowledgeclient.AddResponse{}
  24. c := service.CommonPhrasesService{}
  25. ok, msg := c.CommonPhrasesAdd(in)
  26. if ok {
  27. result.ErrorCode = 0
  28. result.ErrorMsg = msg
  29. } else {
  30. result.ErrorCode = -1
  31. result.ErrorMsg = msg
  32. }
  33. return result, nil
  34. }