commonphrasesaddlogic.go 1.1 KB

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