瀏覽代碼

解决冲突

renjiaojiao 3 年之前
父節點
當前提交
8c5c5d38b2

+ 0 - 7
rpc/knowledge/init/init.go

@@ -20,13 +20,6 @@ var logc entity.Logc
 
 var C config.Config
 
-const (
-	Date_Full_Layout = "2006-01-02 15:04:05"
-	KNOWLEDGE        = "socialize_knowledge"
-	QUESTION         = "socialize_question"
-	ANSWER           = "socialize_answer"
-)
-
 var (
 	Mysql *mysql.Mysql
 )

+ 3 - 4
rpc/knowledge/internal/logic/findanswerlogic.go

@@ -7,11 +7,10 @@ import (
 	"fmt"
 	"github.com/zeromicro/go-zero/core/logx"
 	. "knowledgeBase/rpc/knowledge/init"
+	"knowledgeBase/rpc/knowledge/internal/svc"
 	"knowledgeBase/rpc/knowledge/knowledgeclient"
-	"knowledgeBase/rpc/knowledge/utils"
+	"knowledgeBase/rpc/knowledge/util"
 	"strconv"
-
-	"knowledgeBase/rpc/knowledge/internal/svc"
 )
 
 type FindAnswerLogic struct {
@@ -32,7 +31,7 @@ func (l *FindAnswerLogic) FindAnswer(in *knowledgeclient.FindAnswerReq) (*knowle
 	// todo: add your logic here and delete this line
 	var question *knowledgeclient.Question
 	tenantId := strconv.Itoa(int(in.TenantId))
-	query := utils.DSL4SmartResponse(in.Question, tenantId, int(in.Type))
+	query := util.DSL4SmartResponse(in.Question, tenantId, int(in.Type))
 	fmt.Println("query:", query)
 	res := elastic.Get(C.Es.Index, C.Es.Type, query)
 	if res != nil && len(*res) > 0 {

+ 57 - 4
rpc/knowledge/internal/logic/knowledgeaddlogic.go

@@ -2,10 +2,15 @@ package logic
 
 import (
 	"context"
-	"github.com/zeromicro/go-zero/core/logx"
-	"knowledgeBase/rpc/knowledge/knowledgeclient"
 
+	"database/sql"
+	"github.com/zeromicro/go-zero/core/logx"
+	. "knowledgeBase/rpc/knowledge/init"
 	"knowledgeBase/rpc/knowledge/internal/svc"
+	"knowledgeBase/rpc/knowledge/knowledgeclient"
+	"knowledgeBase/rpc/knowledge/util"
+	"log"
+	"time"
 )
 
 type KnowledgeAddLogic struct {
@@ -22,9 +27,57 @@ func NewKnowledgeAddLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Know
 	}
 }
 
+type Question struct {
+	Question string `json:"question"`
+	KeyWords string `json:"keyWords"`
+}
+
 // 知识新增
 func (l *KnowledgeAddLogic) KnowledgeAdd(in *knowledgeclient.AddRequest) (*knowledgeclient.AddResponse, error) {
 	// todo: add your logic here and delete this line
-
-	return &knowledgeclient.AddResponse{}, nil
+	result := &knowledgeclient.AddResponse{}
+	//先查找知识库Id
+	query := map[string]interface{}{"state": 1, "appid": in.AppId, "tenant_id": in.TenantId}
+	datalist := Mysql.Find(util.KNOWLEDGE, query, "id", "", -1, -1)
+	if datalist != nil && *datalist != nil && len(*datalist) > 0 {
+		fool := Mysql.ExecTx("创建其他订单生成订单信息和合同信息", func(tx *sql.Tx) bool {
+			//插入答案
+			answerData := map[string]interface{}{
+				"knowledge_id":  (*datalist)[0]["id"],
+				"status":        1,
+				"create_time":   time.Now().Local().Format(util.Date_Full_Layout),
+				"update_time":   time.Now().Local().Format(util.Date_Full_Layout),
+				"create_person": in.Person,
+				"content":       in.Answer,
+			}
+			answer_id := Mysql.Insert(util.ANSWER, answerData)
+			if answer_id <= 0 {
+				return false
+			}
+			//插入问题
+			//先分词
+			keywords := util.HttpDo(in.Question)
+			questionData := map[string]interface{}{
+				"answer_id": answer_id,
+				"content":   1,
+				"keywords":  keywords,
+			}
+			question_id := Mysql.Insert(util.QUESTION, questionData)
+			if question_id <= 0 {
+				return false
+			}
+			return true
+		})
+		if fool {
+			result.ErrorCode = 0
+		} else {
+			result.ErrorCode = -1
+			result.ErrorMsg = "新建失败"
+		}
+	} else {
+		log.Println("租户不存在")
+		result.ErrorCode = -1
+		result.ErrorMsg = "租户不存在"
+	}
+	return result, nil
 }

+ 36 - 5
rpc/knowledge/internal/logic/knowledgeditlogic.go

@@ -2,10 +2,12 @@ package logic
 
 import (
 	"context"
-	"knowledgeBase/rpc/knowledge/knowledgeclient"
-
-	"github.com/tal-tech/go-zero/core/logx"
+	"github.com/zeromicro/go-zero/core/logx"
+	. "knowledgeBase/rpc/knowledge/init"
 	"knowledgeBase/rpc/knowledge/internal/svc"
+	"knowledgeBase/rpc/knowledge/knowledgeclient"
+	"knowledgeBase/rpc/knowledge/util"
+	"time"
 )
 
 type KnowledgEditLogic struct {
@@ -25,6 +27,35 @@ func NewKnowledgEditLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Know
 // 知识编辑
 func (l *KnowledgEditLogic) KnowledgEdit(in *knowledgeclient.KnowledgeEntity) (*knowledgeclient.AddResponse, error) {
 	// todo: add your logic here and delete this line
-
-	return &knowledgeclient.AddResponse{}, nil
+	result := &knowledgeclient.AddResponse{}
+	//修改答案
+	answerUpdate := map[string]interface{}{
+		"update_time": time.Now().Local().Format(util.Date_Full_Layout),
+		"content":     in.Answer,
+	}
+	if in.State == 0 {
+		answerUpdate["state"] = 0
+	}
+	ok := Mysql.Update(util.ANSWER, map[string]interface{}{"id": in.AnswerId}, answerUpdate)
+	keywords := util.HttpDo(in.Question)
+	questionUpdate := map[string]interface{}{
+		"content":  1,
+		"keywords": keywords,
+	}
+	if !ok {
+		result.ErrorCode = -1
+		result.ErrorMsg = "答案修改失败"
+		return result, nil
+	}
+	//修改问题
+	ok = Mysql.Update(util.QUESTION, map[string]interface{}{"answerId": in.AnswerId}, questionUpdate)
+	if in.State != 0 {
+		//修改es数据
+	}
+	if !ok {
+		result.ErrorCode = -1
+		result.ErrorMsg = "问题修改失败"
+		return result, nil
+	}
+	return result, nil
 }

+ 17 - 4
rpc/knowledge/internal/logic/knowledgeinfologic.go

@@ -1,11 +1,13 @@
 package logic
 
 import (
+	quitl "app.yhyue.com/moapp/jybase/common"
 	"context"
-	"knowledgeBase/rpc/knowledge/knowledgeclient"
-
-	"github.com/tal-tech/go-zero/core/logx"
+	"github.com/zeromicro/go-zero/core/logx"
+	. "knowledgeBase/rpc/knowledge/init"
 	"knowledgeBase/rpc/knowledge/internal/svc"
+	"knowledgeBase/rpc/knowledge/knowledgeclient"
+	"knowledgeBase/rpc/knowledge/util"
 )
 
 type KnowledgeInfoLogic struct {
@@ -23,8 +25,19 @@ func NewKnowledgeInfoLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Kno
 }
 
 // 知识详情
+
 func (l *KnowledgeInfoLogic) KnowledgeInfo(in *knowledgeclient.KnowledgeEntity) (*knowledgeclient.InfoResponse, error) {
 	// todo: add your logic here and delete this line
-
+	//答案问题详情
+	result := &knowledgeclient.InfoResponse{}
+	sql := "SELECT     b.content as answer ,c.content as question ,b.id  FROM      ? b     LEFT JOIN ? c ON b.id = c.answer_id WHERE     b.`status` =1 "
+	datalist := Mysql.SelectBySql(sql, util.ANSWER, util.QUESTION, in.AnswerId)
+	if datalist != nil && *datalist != nil && len(*datalist) > 0 {
+		knowledge := knowledgeclient.KnowledgeEntity{}
+		knowledge.Answer = quitl.ObjToString((*datalist)[0]["answer"])
+		knowledge.Question = quitl.ObjToString((*datalist)[0]["question"])
+		knowledge.AnswerId = quitl.Int64All((*datalist)[0]["id"])
+		result.Data = &knowledge
+	}
 	return &knowledgeclient.InfoResponse{}, nil
 }

+ 22 - 5
rpc/knowledge/internal/logic/knowledgelistlogic.go

@@ -1,11 +1,13 @@
 package logic
 
 import (
+	quitl "app.yhyue.com/moapp/jybase/common"
 	"context"
-	"knowledgeBase/rpc/knowledge/knowledgeclient"
-
-	"github.com/tal-tech/go-zero/core/logx"
+	"github.com/zeromicro/go-zero/core/logx"
+	. "knowledgeBase/rpc/knowledge/init"
 	"knowledgeBase/rpc/knowledge/internal/svc"
+	"knowledgeBase/rpc/knowledge/knowledgeclient"
+	"knowledgeBase/rpc/knowledge/util"
 )
 
 type KnowledgeListLogic struct {
@@ -25,6 +27,21 @@ func NewKnowledgeListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Kno
 // 知识列表
 func (l *KnowledgeListLogic) KnowledgeList(in *knowledgeclient.ListRequest) (*knowledgeclient.ListResponse, error) {
 	// todo: add your logic here and delete this line
-
-	return &knowledgeclient.ListResponse{}, nil
+	result := &knowledgeclient.ListResponse{}
+	knowledgeList := []*knowledgeclient.KnowledgeEntity{}
+	//列表数据
+	sql := "SELECT     b.content as answer ,c.content as question ,b.id  FROM     ? a     LEFT JOIN ? b ON a.id = b.knowledge_id     LEFT JOIN ? c ON b.id = c.answer_id WHERE     b.`status` =1 and a.tenant_id=? limit ?,?"
+	datalist := Mysql.SelectBySql(sql, util.KNOWLEDGE, util.ANSWER, util.QUESTION, in.TenantId, in.PageIndex, in.PageSize)
+	if datalist != nil && *datalist != nil && len(*datalist) > 0 {
+		for _, value := range *datalist {
+			knowledge := knowledgeclient.KnowledgeEntity{}
+			knowledge.Answer = quitl.ObjToString(value["answer"])
+			knowledge.Question = quitl.ObjToString(value["question"])
+			knowledge.AnswerId = quitl.Int64All(value["id"])
+			knowledgeList = append(knowledgeList, &knowledge)
+		}
+	}
+	result.ErrorCode = 0
+	result.Data = knowledgeList
+	return result, nil
 }

+ 3 - 3
rpc/knowledge/internal/logic/recommendanswerlogic.go

@@ -10,7 +10,7 @@ import (
 	"knowledgeBase/rpc/knowledge/internal/svc"
 	"knowledgeBase/rpc/knowledge/knowledge"
 	"knowledgeBase/rpc/knowledge/knowledgeclient"
-	"knowledgeBase/rpc/knowledge/utils"
+	"knowledgeBase/rpc/knowledge/util"
 	"log"
 	"strconv"
 	"strings"
@@ -33,7 +33,7 @@ func NewRecommendAnswerLogic(ctx context.Context, svcCtx *svc.ServiceContext) *R
 func (l *RecommendAnswerLogic) RecommendAnswer(in *knowledgeclient.FindAnswerReq) (*knowledgeclient.RecommendAnswerResp, error) {
 	var knowledges []*knowledge.Question
 	//根据问题进行分词
-	kwResp := utils.HttpDo(in.Question)
+	kwResp := util.HttpDo(in.Question)
 	var kwMap []map[string]interface{}
 	err := json.Unmarshal([]byte(kwResp), &kwMap)
 	if err != nil {
@@ -54,7 +54,7 @@ func (l *RecommendAnswerLogic) RecommendAnswer(in *knowledgeclient.FindAnswerReq
 	//fmt.Println("关键字:", kws)
 	var searchField = `"_id","answer","questions"`
 	if keyWords != "" {
-		var query = utils.DSL4SearchByKwsOrid(keyWords, strconv.Itoa(int(in.TenantId)))
+		var query = util.DSL4SearchByKwsOrid(keyWords, strconv.Itoa(int(in.TenantId)))
 		res := elastic.GetAllByNgram(C.Es.Index, C.Es.Type, query, "", "", searchField, 0, 3, 0, false)
 		//log.Println("link_obj:", link_obj)
 		if res != nil && len(*res) > 0 {

+ 7 - 7
rpc/knowledge/internal/server/knowledgeserver.go

@@ -5,10 +5,10 @@ package server
 
 import (
 	"context"
-	"knowledgeBase/rpc/knowledge/knowledgeclient"
 
 	"knowledgeBase/rpc/knowledge/internal/logic"
 	"knowledgeBase/rpc/knowledge/internal/svc"
+	"knowledgeBase/rpc/knowledge/knowledge"
 )
 
 type KnowledgeServer struct {
@@ -22,37 +22,37 @@ func NewKnowledgeServer(svcCtx *svc.ServiceContext) *KnowledgeServer {
 }
 
 // 知识新增
-func (s *KnowledgeServer) KnowledgeAdd(ctx context.Context, in *knowledgeclient.AddRequest) (*knowledgeclient.AddResponse, error) {
+func (s *KnowledgeServer) KnowledgeAdd(ctx context.Context, in *knowledge.AddRequest) (*knowledge.AddResponse, error) {
 	l := logic.NewKnowledgeAddLogic(ctx, s.svcCtx)
 	return l.KnowledgeAdd(in)
 }
 
 // 知识列表
-func (s *KnowledgeServer) KnowledgeList(ctx context.Context, in *knowledgeclient.ListRequest) (*knowledgeclient.ListResponse, error) {
+func (s *KnowledgeServer) KnowledgeList(ctx context.Context, in *knowledge.ListRequest) (*knowledge.ListResponse, error) {
 	l := logic.NewKnowledgeListLogic(ctx, s.svcCtx)
 	return l.KnowledgeList(in)
 }
 
 // 知识编辑
-func (s *KnowledgeServer) KnowledgEdit(ctx context.Context, in *knowledgeclient.KnowledgeEntity) (*knowledgeclient.AddResponse, error) {
+func (s *KnowledgeServer) KnowledgEdit(ctx context.Context, in *knowledge.KnowledgeEntity) (*knowledge.AddResponse, error) {
 	l := logic.NewKnowledgEditLogic(ctx, s.svcCtx)
 	return l.KnowledgEdit(in)
 }
 
 // 知识详情
-func (s *KnowledgeServer) KnowledgeInfo(ctx context.Context, in *knowledgeclient.KnowledgeEntity) (*knowledgeclient.InfoResponse, error) {
+func (s *KnowledgeServer) KnowledgeInfo(ctx context.Context, in *knowledge.KnowledgeEntity) (*knowledge.InfoResponse, error) {
 	l := logic.NewKnowledgeInfoLogic(ctx, s.svcCtx)
 	return l.KnowledgeInfo(in)
 }
 
 // 根据问题匹配答案
-func (s *KnowledgeServer) FindAnswer(ctx context.Context, in *knowledgeclient.FindAnswerReq) (*knowledgeclient.FindAnswerResp, error) {
+func (s *KnowledgeServer) FindAnswer(ctx context.Context, in *knowledge.FindAnswerReq) (*knowledge.FindAnswerResp, error) {
 	l := logic.NewFindAnswerLogic(ctx, s.svcCtx)
 	return l.FindAnswer(in)
 }
 
 // 推荐答案
-func (s *KnowledgeServer) RecommendAnswer(ctx context.Context, in *knowledgeclient.FindAnswerReq) (*knowledgeclient.RecommendAnswerResp, error) {
+func (s *KnowledgeServer) RecommendAnswer(ctx context.Context, in *knowledge.FindAnswerReq) (*knowledge.RecommendAnswerResp, error) {
 	l := logic.NewRecommendAnswerLogic(ctx, s.svcCtx)
 	return l.RecommendAnswer(in)
 }

+ 1 - 0
rpc/knowledge/knowledge.proto

@@ -46,6 +46,7 @@ message RecommendAnswerResp{
 message ListRequest  {
   	int64 pageSize = 1;//每页数据量,默认10
   	int64 pageIndex = 2;//页码;默认第一页
+  	int64 tenantId = 3;//租户id
 }
 message ListResponse  {
    int64 error_code = 1; //响应代码

+ 64 - 55
rpc/knowledge/knowledge/knowledge.pb.go

@@ -1,7 +1,7 @@
 // Code generated by protoc-gen-go. DO NOT EDIT.
 // versions:
-// 	protoc-gen-go v1.27.1
-// 	protoc        v3.19.4
+// 	protoc-gen-go v1.26.0
+// 	protoc        v3.15.1
 // source: knowledge.proto
 
 package knowledge
@@ -433,6 +433,7 @@ type ListRequest struct {
 
 	PageSize  int64 `protobuf:"varint,1,opt,name=pageSize,proto3" json:"pageSize,omitempty"`   //每页数据量,默认10
 	PageIndex int64 `protobuf:"varint,2,opt,name=pageIndex,proto3" json:"pageIndex,omitempty"` //页码;默认第一页
+	TenantId  int64 `protobuf:"varint,3,opt,name=tenantId,proto3" json:"tenantId,omitempty"`   //租户id
 }
 
 func (x *ListRequest) Reset() {
@@ -481,6 +482,13 @@ func (x *ListRequest) GetPageIndex() int64 {
 	return 0
 }
 
+func (x *ListRequest) GetTenantId() int64 {
+	if x != nil {
+		return x.TenantId
+	}
+	return 0
+}
+
 type ListResponse struct {
 	state         protoimpl.MessageState
 	sizeCache     protoimpl.SizeCache
@@ -732,64 +740,65 @@ var file_knowledge_proto_rawDesc = []byte{
 	0x5f, 0x6d, 0x73, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x65, 0x72, 0x72, 0x6f,
 	0x72, 0x4d, 0x73, 0x67, 0x12, 0x26, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x03, 0x20, 0x03,
 	0x28, 0x0b, 0x32, 0x12, 0x2e, 0x74, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x2e, 0x51, 0x75,
-	0x65, 0x73, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x47, 0x0a, 0x0b,
+	0x65, 0x73, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x63, 0x0a, 0x0b,
 	0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x70,
 	0x61, 0x67, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x70,
 	0x61, 0x67, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x70, 0x61, 0x67, 0x65, 0x49,
 	0x6e, 0x64, 0x65, 0x78, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x70, 0x61, 0x67, 0x65,
-	0x49, 0x6e, 0x64, 0x65, 0x78, 0x22, 0x79, 0x0a, 0x0c, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73,
-	0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x5f, 0x63,
-	0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x65, 0x72, 0x72, 0x6f, 0x72,
-	0x43, 0x6f, 0x64, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x5f, 0x6d, 0x73,
-	0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x4d, 0x73,
-	0x67, 0x12, 0x2d, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32,
-	0x19, 0x2e, 0x74, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x2e, 0x4b, 0x6e, 0x6f, 0x77, 0x6c,
-	0x65, 0x64, 0x67, 0x65, 0x45, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61,
-	0x22, 0x8f, 0x01, 0x0a, 0x0f, 0x4b, 0x6e, 0x6f, 0x77, 0x6c, 0x65, 0x64, 0x67, 0x65, 0x45, 0x6e,
-	0x74, 0x69, 0x74, 0x79, 0x12, 0x1a, 0x0a, 0x08, 0x71, 0x75, 0x65, 0x73, 0x74, 0x69, 0x6f, 0x6e,
-	0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x71, 0x75, 0x65, 0x73, 0x74, 0x69, 0x6f, 0x6e,
-	0x12, 0x16, 0x0a, 0x06, 0x61, 0x6e, 0x73, 0x77, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09,
-	0x52, 0x06, 0x61, 0x6e, 0x73, 0x77, 0x65, 0x72, 0x12, 0x1a, 0x0a, 0x08, 0x61, 0x6e, 0x73, 0x77,
-	0x65, 0x72, 0x49, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x61, 0x6e, 0x73, 0x77,
-	0x65, 0x72, 0x49, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x04, 0x20,
-	0x01, 0x28, 0x03, 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x70, 0x65,
-	0x72, 0x73, 0x6f, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x70, 0x65, 0x72, 0x73,
-	0x6f, 0x6e, 0x22, 0x79, 0x0a, 0x0c, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
-	0x73, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x5f, 0x63, 0x6f, 0x64, 0x65,
-	0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x43, 0x6f, 0x64,
-	0x65, 0x12, 0x1b, 0x0a, 0x09, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x5f, 0x6d, 0x73, 0x67, 0x18, 0x02,
-	0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x4d, 0x73, 0x67, 0x12, 0x2d,
-	0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x74,
-	0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x2e, 0x4b, 0x6e, 0x6f, 0x77, 0x6c, 0x65, 0x64, 0x67,
-	0x65, 0x45, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x32, 0x9a, 0x03,
-	0x0a, 0x09, 0x6b, 0x6e, 0x6f, 0x77, 0x6c, 0x65, 0x64, 0x67, 0x65, 0x12, 0x3b, 0x0a, 0x0c, 0x4b,
-	0x6e, 0x6f, 0x77, 0x6c, 0x65, 0x64, 0x67, 0x65, 0x41, 0x64, 0x64, 0x12, 0x14, 0x2e, 0x74, 0x65,
-	0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x2e, 0x41, 0x64, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
-	0x74, 0x1a, 0x15, 0x2e, 0x74, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x2e, 0x41, 0x64, 0x64,
-	0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3e, 0x0a, 0x0d, 0x4b, 0x6e, 0x6f, 0x77,
-	0x6c, 0x65, 0x64, 0x67, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x15, 0x2e, 0x74, 0x65, 0x6d, 0x70,
-	0x6c, 0x61, 0x74, 0x65, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
-	0x1a, 0x16, 0x2e, 0x74, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x2e, 0x4c, 0x69, 0x73, 0x74,
-	0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x40, 0x0a, 0x0c, 0x4b, 0x6e, 0x6f, 0x77,
-	0x6c, 0x65, 0x64, 0x67, 0x45, 0x64, 0x69, 0x74, 0x12, 0x19, 0x2e, 0x74, 0x65, 0x6d, 0x70, 0x6c,
-	0x61, 0x74, 0x65, 0x2e, 0x4b, 0x6e, 0x6f, 0x77, 0x6c, 0x65, 0x64, 0x67, 0x65, 0x45, 0x6e, 0x74,
-	0x69, 0x74, 0x79, 0x1a, 0x15, 0x2e, 0x74, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x2e, 0x41,
-	0x64, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x42, 0x0a, 0x0d, 0x4b, 0x6e,
-	0x6f, 0x77, 0x6c, 0x65, 0x64, 0x67, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x19, 0x2e, 0x74, 0x65,
+	0x49, 0x6e, 0x64, 0x65, 0x78, 0x12, 0x1a, 0x0a, 0x08, 0x74, 0x65, 0x6e, 0x61, 0x6e, 0x74, 0x49,
+	0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x74, 0x65, 0x6e, 0x61, 0x6e, 0x74, 0x49,
+	0x64, 0x22, 0x79, 0x0a, 0x0c, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
+	0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x18,
+	0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x43, 0x6f, 0x64, 0x65,
+	0x12, 0x1b, 0x0a, 0x09, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x5f, 0x6d, 0x73, 0x67, 0x18, 0x02, 0x20,
+	0x01, 0x28, 0x09, 0x52, 0x08, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x4d, 0x73, 0x67, 0x12, 0x2d, 0x0a,
+	0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x74, 0x65,
 	0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x2e, 0x4b, 0x6e, 0x6f, 0x77, 0x6c, 0x65, 0x64, 0x67, 0x65,
-	0x45, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x1a, 0x16, 0x2e, 0x74, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74,
-	0x65, 0x2e, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3f,
-	0x0a, 0x0a, 0x46, 0x69, 0x6e, 0x64, 0x41, 0x6e, 0x73, 0x77, 0x65, 0x72, 0x12, 0x17, 0x2e, 0x74,
-	0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x2e, 0x46, 0x69, 0x6e, 0x64, 0x41, 0x6e, 0x73, 0x77,
-	0x65, 0x72, 0x52, 0x65, 0x71, 0x1a, 0x18, 0x2e, 0x74, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65,
-	0x2e, 0x46, 0x69, 0x6e, 0x64, 0x41, 0x6e, 0x73, 0x77, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x12,
-	0x49, 0x0a, 0x0f, 0x52, 0x65, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x64, 0x41, 0x6e, 0x73, 0x77,
-	0x65, 0x72, 0x12, 0x17, 0x2e, 0x74, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x2e, 0x46, 0x69,
-	0x6e, 0x64, 0x41, 0x6e, 0x73, 0x77, 0x65, 0x72, 0x52, 0x65, 0x71, 0x1a, 0x1d, 0x2e, 0x74, 0x65,
-	0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x2e, 0x52, 0x65, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x64,
-	0x41, 0x6e, 0x73, 0x77, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x42, 0x0d, 0x5a, 0x0b, 0x2e, 0x2f,
-	0x6b, 0x6e, 0x6f, 0x77, 0x6c, 0x65, 0x64, 0x67, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f,
-	0x33,
+	0x45, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x8f, 0x01, 0x0a,
+	0x0f, 0x4b, 0x6e, 0x6f, 0x77, 0x6c, 0x65, 0x64, 0x67, 0x65, 0x45, 0x6e, 0x74, 0x69, 0x74, 0x79,
+	0x12, 0x1a, 0x0a, 0x08, 0x71, 0x75, 0x65, 0x73, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01,
+	0x28, 0x09, 0x52, 0x08, 0x71, 0x75, 0x65, 0x73, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x16, 0x0a, 0x06,
+	0x61, 0x6e, 0x73, 0x77, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x61, 0x6e,
+	0x73, 0x77, 0x65, 0x72, 0x12, 0x1a, 0x0a, 0x08, 0x61, 0x6e, 0x73, 0x77, 0x65, 0x72, 0x49, 0x64,
+	0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x61, 0x6e, 0x73, 0x77, 0x65, 0x72, 0x49, 0x64,
+	0x12, 0x14, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52,
+	0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x70, 0x65, 0x72, 0x73, 0x6f, 0x6e,
+	0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x70, 0x65, 0x72, 0x73, 0x6f, 0x6e, 0x22, 0x79,
+	0x0a, 0x0c, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1d,
+	0x0a, 0x0a, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01,
+	0x28, 0x03, 0x52, 0x09, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x1b, 0x0a,
+	0x09, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x5f, 0x6d, 0x73, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09,
+	0x52, 0x08, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x4d, 0x73, 0x67, 0x12, 0x2d, 0x0a, 0x04, 0x64, 0x61,
+	0x74, 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x74, 0x65, 0x6d, 0x70, 0x6c,
+	0x61, 0x74, 0x65, 0x2e, 0x4b, 0x6e, 0x6f, 0x77, 0x6c, 0x65, 0x64, 0x67, 0x65, 0x45, 0x6e, 0x74,
+	0x69, 0x74, 0x79, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x32, 0x9a, 0x03, 0x0a, 0x09, 0x6b, 0x6e,
+	0x6f, 0x77, 0x6c, 0x65, 0x64, 0x67, 0x65, 0x12, 0x3b, 0x0a, 0x0c, 0x4b, 0x6e, 0x6f, 0x77, 0x6c,
+	0x65, 0x64, 0x67, 0x65, 0x41, 0x64, 0x64, 0x12, 0x14, 0x2e, 0x74, 0x65, 0x6d, 0x70, 0x6c, 0x61,
+	0x74, 0x65, 0x2e, 0x41, 0x64, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x15, 0x2e,
+	0x74, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x2e, 0x41, 0x64, 0x64, 0x52, 0x65, 0x73, 0x70,
+	0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3e, 0x0a, 0x0d, 0x4b, 0x6e, 0x6f, 0x77, 0x6c, 0x65, 0x64, 0x67,
+	0x65, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x15, 0x2e, 0x74, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65,
+	0x2e, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x74,
+	0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70,
+	0x6f, 0x6e, 0x73, 0x65, 0x12, 0x40, 0x0a, 0x0c, 0x4b, 0x6e, 0x6f, 0x77, 0x6c, 0x65, 0x64, 0x67,
+	0x45, 0x64, 0x69, 0x74, 0x12, 0x19, 0x2e, 0x74, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x2e,
+	0x4b, 0x6e, 0x6f, 0x77, 0x6c, 0x65, 0x64, 0x67, 0x65, 0x45, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x1a,
+	0x15, 0x2e, 0x74, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x2e, 0x41, 0x64, 0x64, 0x52, 0x65,
+	0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x42, 0x0a, 0x0d, 0x4b, 0x6e, 0x6f, 0x77, 0x6c, 0x65,
+	0x64, 0x67, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x19, 0x2e, 0x74, 0x65, 0x6d, 0x70, 0x6c, 0x61,
+	0x74, 0x65, 0x2e, 0x4b, 0x6e, 0x6f, 0x77, 0x6c, 0x65, 0x64, 0x67, 0x65, 0x45, 0x6e, 0x74, 0x69,
+	0x74, 0x79, 0x1a, 0x16, 0x2e, 0x74, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x2e, 0x49, 0x6e,
+	0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3f, 0x0a, 0x0a, 0x46, 0x69,
+	0x6e, 0x64, 0x41, 0x6e, 0x73, 0x77, 0x65, 0x72, 0x12, 0x17, 0x2e, 0x74, 0x65, 0x6d, 0x70, 0x6c,
+	0x61, 0x74, 0x65, 0x2e, 0x46, 0x69, 0x6e, 0x64, 0x41, 0x6e, 0x73, 0x77, 0x65, 0x72, 0x52, 0x65,
+	0x71, 0x1a, 0x18, 0x2e, 0x74, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x2e, 0x46, 0x69, 0x6e,
+	0x64, 0x41, 0x6e, 0x73, 0x77, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x12, 0x49, 0x0a, 0x0f, 0x52,
+	0x65, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x64, 0x41, 0x6e, 0x73, 0x77, 0x65, 0x72, 0x12, 0x17,
+	0x2e, 0x74, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x2e, 0x46, 0x69, 0x6e, 0x64, 0x41, 0x6e,
+	0x73, 0x77, 0x65, 0x72, 0x52, 0x65, 0x71, 0x1a, 0x1d, 0x2e, 0x74, 0x65, 0x6d, 0x70, 0x6c, 0x61,
+	0x74, 0x65, 0x2e, 0x52, 0x65, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x64, 0x41, 0x6e, 0x73, 0x77,
+	0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x42, 0x0d, 0x5a, 0x0b, 0x2e, 0x2f, 0x6b, 0x6e, 0x6f, 0x77,
+	0x6c, 0x65, 0x64, 0x67, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
 }
 
 var (

+ 5 - 5
rpc/knowledge/knowledgeclient/knowledge.go

@@ -13,15 +13,15 @@ import (
 )
 
 type (
-	AddRequest          = knowledge.AddRequest
-	AddResponse         = knowledge.AddResponse
-	RecommendAnswerResp = knowledge.RecommendAnswerResp
-	ListRequest         = knowledge.ListRequest
 	Question            = knowledge.Question
+	AddResponse         = knowledge.AddResponse
 	FindAnswerReq       = knowledge.FindAnswerReq
-	FindAnswerResp      = knowledge.FindAnswerResp
 	ListResponse        = knowledge.ListResponse
 	KnowledgeEntity     = knowledge.KnowledgeEntity
+	AddRequest          = knowledge.AddRequest
+	FindAnswerResp      = knowledge.FindAnswerResp
+	RecommendAnswerResp = knowledge.RecommendAnswerResp
+	ListRequest         = knowledge.ListRequest
 	InfoResponse        = knowledge.InfoResponse
 
 	Knowledge interface {

+ 2 - 0
rpc/knowledge/logs/access.log

@@ -11,3 +11,5 @@
 {"@timestamp":"2022-06-17T10:00:38.937+08:00","level":"info","content":"info--日志记录"}
 {"@timestamp":"2022-06-17T10:00:38.937+08:00","level":"info","content":"error--日志记录"}
 >>>>>>> d81a3e824563ad13a0defcc6df0b53a6e6cd6f4c
+{"@timestamp":"2022-06-17T14:41:35.451+08:00","level":"info","content":"info--日志记录"}
+{"@timestamp":"2022-06-17T14:41:35.451+08:00","level":"info","content":"error--日志记录"}

+ 58 - 0
rpc/knowledge/logs/stat.log

@@ -713,3 +713,61 @@
 {"@timestamp":"2022-06-17T13:21:08.218+08:00","level":"stat","content":"CPU: 0m, MEMORY: Alloc=3.5Mi, TotalAlloc=29.1Mi, Sys=17.8Mi, NumGC=131"}
 {"@timestamp":"2022-06-17T13:21:29.366+08:00","level":"stat","content":"(rpc) shedding_stat [1m], cpu: 0, total: 0, pass: 0, drop: 0"}
 >>>>>>> d81a3e824563ad13a0defcc6df0b53a6e6cd6f4c
+{"@timestamp":"2022-06-17T14:42:35.410+08:00","level":"stat","content":"CPU: 0m, MEMORY: Alloc=4.0Mi, TotalAlloc=6.8Mi, Sys=17.3Mi, NumGC=2"}
+{"@timestamp":"2022-06-17T14:42:35.452+08:00","level":"stat","content":"(rpc) shedding_stat [1m], cpu: 0, total: 0, pass: 0, drop: 0"}
+{"@timestamp":"2022-06-17T14:43:35.398+08:00","level":"stat","content":"CPU: 0m, MEMORY: Alloc=4.1Mi, TotalAlloc=6.9Mi, Sys=17.3Mi, NumGC=2"}
+{"@timestamp":"2022-06-17T14:43:35.456+08:00","level":"stat","content":"(rpc) shedding_stat [1m], cpu: 0, total: 0, pass: 0, drop: 0"}
+{"@timestamp":"2022-06-17T14:44:35.399+08:00","level":"stat","content":"CPU: 0m, MEMORY: Alloc=3.4Mi, TotalAlloc=7.0Mi, Sys=17.8Mi, NumGC=3"}
+{"@timestamp":"2022-06-17T14:44:35.453+08:00","level":"stat","content":"(rpc) shedding_stat [1m], cpu: 0, total: 0, pass: 0, drop: 0"}
+{"@timestamp":"2022-06-17T14:45:35.398+08:00","level":"stat","content":"CPU: 0m, MEMORY: Alloc=3.5Mi, TotalAlloc=7.1Mi, Sys=17.8Mi, NumGC=3"}
+{"@timestamp":"2022-06-17T14:45:35.454+08:00","level":"stat","content":"(rpc) shedding_stat [1m], cpu: 0, total: 0, pass: 0, drop: 0"}
+{"@timestamp":"2022-06-17T14:46:35.401+08:00","level":"stat","content":"CPU: 0m, MEMORY: Alloc=3.4Mi, TotalAlloc=7.2Mi, Sys=17.8Mi, NumGC=4"}
+{"@timestamp":"2022-06-17T14:46:35.454+08:00","level":"stat","content":"(rpc) shedding_stat [1m], cpu: 0, total: 0, pass: 0, drop: 0"}
+{"@timestamp":"2022-06-17T14:47:35.408+08:00","level":"stat","content":"CPU: 0m, MEMORY: Alloc=3.5Mi, TotalAlloc=7.3Mi, Sys=17.8Mi, NumGC=4"}
+{"@timestamp":"2022-06-17T14:47:35.454+08:00","level":"stat","content":"(rpc) shedding_stat [1m], cpu: 0, total: 0, pass: 0, drop: 0"}
+{"@timestamp":"2022-06-17T14:48:35.402+08:00","level":"stat","content":"CPU: 0m, MEMORY: Alloc=3.4Mi, TotalAlloc=7.4Mi, Sys=17.8Mi, NumGC=5"}
+{"@timestamp":"2022-06-17T14:48:35.454+08:00","level":"stat","content":"(rpc) shedding_stat [1m], cpu: 0, total: 0, pass: 0, drop: 0"}
+{"@timestamp":"2022-06-17T14:49:35.399+08:00","level":"stat","content":"CPU: 0m, MEMORY: Alloc=3.5Mi, TotalAlloc=7.5Mi, Sys=17.8Mi, NumGC=5"}
+{"@timestamp":"2022-06-17T14:49:35.454+08:00","level":"stat","content":"(rpc) shedding_stat [1m], cpu: 0, total: 0, pass: 0, drop: 0"}
+{"@timestamp":"2022-06-17T14:50:35.406+08:00","level":"stat","content":"CPU: 0m, MEMORY: Alloc=3.3Mi, TotalAlloc=7.6Mi, Sys=17.8Mi, NumGC=6"}
+{"@timestamp":"2022-06-17T14:50:35.452+08:00","level":"stat","content":"(rpc) shedding_stat [1m], cpu: 0, total: 0, pass: 0, drop: 0"}
+{"@timestamp":"2022-06-17T14:51:35.412+08:00","level":"stat","content":"CPU: 0m, MEMORY: Alloc=3.5Mi, TotalAlloc=7.8Mi, Sys=17.8Mi, NumGC=6"}
+{"@timestamp":"2022-06-17T14:51:35.458+08:00","level":"stat","content":"(rpc) shedding_stat [1m], cpu: 0, total: 0, pass: 0, drop: 0"}
+{"@timestamp":"2022-06-17T14:52:35.404+08:00","level":"stat","content":"CPU: 0m, MEMORY: Alloc=3.3Mi, TotalAlloc=7.8Mi, Sys=17.8Mi, NumGC=7"}
+{"@timestamp":"2022-06-17T14:52:35.456+08:00","level":"stat","content":"(rpc) shedding_stat [1m], cpu: 0, total: 0, pass: 0, drop: 0"}
+{"@timestamp":"2022-06-17T14:53:35.403+08:00","level":"stat","content":"CPU: 0m, MEMORY: Alloc=3.5Mi, TotalAlloc=8.0Mi, Sys=17.8Mi, NumGC=7"}
+{"@timestamp":"2022-06-17T14:53:35.452+08:00","level":"stat","content":"(rpc) shedding_stat [1m], cpu: 0, total: 0, pass: 0, drop: 0"}
+{"@timestamp":"2022-06-17T14:54:35.412+08:00","level":"stat","content":"CPU: 0m, MEMORY: Alloc=3.4Mi, TotalAlloc=8.0Mi, Sys=17.8Mi, NumGC=8"}
+{"@timestamp":"2022-06-17T14:54:35.459+08:00","level":"stat","content":"(rpc) shedding_stat [1m], cpu: 0, total: 0, pass: 0, drop: 0"}
+{"@timestamp":"2022-06-17T14:55:35.404+08:00","level":"stat","content":"CPU: 0m, MEMORY: Alloc=3.5Mi, TotalAlloc=8.2Mi, Sys=17.8Mi, NumGC=8"}
+{"@timestamp":"2022-06-17T14:55:35.455+08:00","level":"stat","content":"(rpc) shedding_stat [1m], cpu: 0, total: 0, pass: 0, drop: 0"}
+{"@timestamp":"2022-06-17T14:56:35.403+08:00","level":"stat","content":"CPU: 0m, MEMORY: Alloc=3.4Mi, TotalAlloc=8.3Mi, Sys=17.8Mi, NumGC=9"}
+{"@timestamp":"2022-06-17T14:56:35.452+08:00","level":"stat","content":"(rpc) shedding_stat [1m], cpu: 0, total: 0, pass: 0, drop: 0"}
+{"@timestamp":"2022-06-17T14:57:35.403+08:00","level":"stat","content":"CPU: 0m, MEMORY: Alloc=3.5Mi, TotalAlloc=8.4Mi, Sys=17.8Mi, NumGC=9"}
+{"@timestamp":"2022-06-17T14:57:35.452+08:00","level":"stat","content":"(rpc) shedding_stat [1m], cpu: 0, total: 0, pass: 0, drop: 0"}
+{"@timestamp":"2022-06-17T14:58:35.404+08:00","level":"stat","content":"CPU: 0m, MEMORY: Alloc=3.4Mi, TotalAlloc=8.5Mi, Sys=17.8Mi, NumGC=10"}
+{"@timestamp":"2022-06-17T14:58:35.452+08:00","level":"stat","content":"(rpc) shedding_stat [1m], cpu: 0, total: 0, pass: 0, drop: 0"}
+{"@timestamp":"2022-06-17T14:59:35.412+08:00","level":"stat","content":"CPU: 0m, MEMORY: Alloc=3.5Mi, TotalAlloc=8.6Mi, Sys=17.8Mi, NumGC=10"}
+{"@timestamp":"2022-06-17T14:59:35.451+08:00","level":"stat","content":"(rpc) shedding_stat [1m], cpu: 0, total: 0, pass: 0, drop: 0"}
+{"@timestamp":"2022-06-17T15:00:35.397+08:00","level":"stat","content":"CPU: 0m, MEMORY: Alloc=3.4Mi, TotalAlloc=8.7Mi, Sys=17.8Mi, NumGC=11"}
+{"@timestamp":"2022-06-17T15:00:35.453+08:00","level":"stat","content":"(rpc) shedding_stat [1m], cpu: 0, total: 0, pass: 0, drop: 0"}
+{"@timestamp":"2022-06-17T15:01:35.410+08:00","level":"stat","content":"CPU: 0m, MEMORY: Alloc=3.5Mi, TotalAlloc=8.8Mi, Sys=17.8Mi, NumGC=11"}
+{"@timestamp":"2022-06-17T15:01:35.452+08:00","level":"stat","content":"(rpc) shedding_stat [1m], cpu: 0, total: 0, pass: 0, drop: 0"}
+{"@timestamp":"2022-06-17T15:02:35.410+08:00","level":"stat","content":"CPU: 0m, MEMORY: Alloc=3.4Mi, TotalAlloc=8.9Mi, Sys=17.8Mi, NumGC=12"}
+{"@timestamp":"2022-06-17T15:02:35.455+08:00","level":"stat","content":"(rpc) shedding_stat [1m], cpu: 0, total: 0, pass: 0, drop: 0"}
+{"@timestamp":"2022-06-17T15:03:35.410+08:00","level":"stat","content":"CPU: 0m, MEMORY: Alloc=3.4Mi, TotalAlloc=8.9Mi, Sys=17.8Mi, NumGC=12"}
+{"@timestamp":"2022-06-17T15:03:35.453+08:00","level":"stat","content":"(rpc) shedding_stat [1m], cpu: 0, total: 0, pass: 0, drop: 0"}
+{"@timestamp":"2022-06-17T15:04:35.403+08:00","level":"stat","content":"CPU: 0m, MEMORY: Alloc=3.4Mi, TotalAlloc=9.0Mi, Sys=17.8Mi, NumGC=13"}
+{"@timestamp":"2022-06-17T15:04:35.454+08:00","level":"stat","content":"(rpc) shedding_stat [1m], cpu: 0, total: 0, pass: 0, drop: 0"}
+{"@timestamp":"2022-06-17T15:05:35.399+08:00","level":"stat","content":"CPU: 0m, MEMORY: Alloc=3.5Mi, TotalAlloc=9.1Mi, Sys=17.8Mi, NumGC=13"}
+{"@timestamp":"2022-06-17T15:05:35.453+08:00","level":"stat","content":"(rpc) shedding_stat [1m], cpu: 0, total: 0, pass: 0, drop: 0"}
+{"@timestamp":"2022-06-17T15:06:35.398+08:00","level":"stat","content":"CPU: 0m, MEMORY: Alloc=3.4Mi, TotalAlloc=9.2Mi, Sys=17.8Mi, NumGC=14"}
+{"@timestamp":"2022-06-17T15:06:35.455+08:00","level":"stat","content":"(rpc) shedding_stat [1m], cpu: 0, total: 0, pass: 0, drop: 0"}
+{"@timestamp":"2022-06-17T15:07:35.408+08:00","level":"stat","content":"CPU: 0m, MEMORY: Alloc=3.4Mi, TotalAlloc=9.3Mi, Sys=17.8Mi, NumGC=14"}
+{"@timestamp":"2022-06-17T15:07:35.454+08:00","level":"stat","content":"(rpc) shedding_stat [1m], cpu: 0, total: 0, pass: 0, drop: 0"}
+{"@timestamp":"2022-06-17T15:08:35.401+08:00","level":"stat","content":"CPU: 0m, MEMORY: Alloc=3.4Mi, TotalAlloc=9.4Mi, Sys=17.8Mi, NumGC=15"}
+{"@timestamp":"2022-06-17T15:08:35.458+08:00","level":"stat","content":"(rpc) shedding_stat [1m], cpu: 0, total: 0, pass: 0, drop: 0"}
+{"@timestamp":"2022-06-17T15:09:35.407+08:00","level":"stat","content":"CPU: 0m, MEMORY: Alloc=3.5Mi, TotalAlloc=9.5Mi, Sys=17.8Mi, NumGC=15"}
+{"@timestamp":"2022-06-17T15:09:35.453+08:00","level":"stat","content":"(rpc) shedding_stat [1m], cpu: 0, total: 0, pass: 0, drop: 0"}
+{"@timestamp":"2022-06-17T15:10:35.402+08:00","level":"stat","content":"CPU: 0m, MEMORY: Alloc=3.4Mi, TotalAlloc=9.6Mi, Sys=17.8Mi, NumGC=16"}
+{"@timestamp":"2022-06-17T15:10:35.465+08:00","level":"stat","content":"(rpc) shedding_stat [1m], cpu: 0, total: 0, pass: 0, drop: 0"}

+ 1 - 1
rpc/knowledge/utils/elasticsearch_dsl.go → rpc/knowledge/util/elasticsearch_dsl.go

@@ -1,4 +1,4 @@
-package utils
+package util
 
 import (
 	"fmt"

+ 1 - 1
rpc/knowledge/utils/hanlp.go → rpc/knowledge/util/hanlp.go

@@ -1,4 +1,4 @@
-package utils
+package util
 
 import (
 	cm "app.yhyue.com/moapp/jybase/common"

+ 8 - 0
rpc/knowledge/util/model.go

@@ -0,0 +1,8 @@
+package util
+
+const (
+	Date_Full_Layout = "2006-01-02 15:04:05"
+	KNOWLEDGE        = "socialize_knowledge"
+	QUESTION         = "socialize_question"
+	ANSWER           = "socialize_answer"
+)