package logic import ( . "bp.jydev.jianyu360.cn/SocialPlatform/knowledgeBase/rpc/knowledge/init" "bp.jydev.jianyu360.cn/SocialPlatform/knowledgeBase/rpc/knowledge/internal/service" "bp.jydev.jianyu360.cn/SocialPlatform/knowledgeBase/rpc/knowledge/internal/svc" "bp.jydev.jianyu360.cn/SocialPlatform/knowledgeBase/rpc/knowledge/knowledge" "context" "github.com/zeromicro/go-zero/core/logx" ) type KnowledgeAddLogic struct { ctx context.Context svcCtx *svc.ServiceContext logx.Logger } func NewKnowledgeAddLogic(ctx context.Context, svcCtx *svc.ServiceContext) *KnowledgeAddLogic { return &KnowledgeAddLogic{ ctx: ctx, svcCtx: svcCtx, Logger: logx.WithContext(ctx), } } type Question struct { Question string `json:"question"` KeyWords string `json:"keyWords"` } // KnowledgeAdd 知识新增 func (l *KnowledgeAddLogic) KnowledgeAdd(in *knowledge.AddRequest) (*knowledge.AddResponse, error) { result := &knowledge.AddResponse{} k := service.KnowledgeService{} ok, msg := k.KnowledgeAdd(in, C.Segment) if !ok { result.ErrorCode = -1 result.ErrorMsg = msg } else { result.ErrorCode = 0 result.ErrorMsg = msg } return result, nil }