wangchuanjin 4 years ago
parent
commit
96850b7cd3

+ 1 - 1
go.mod

@@ -3,7 +3,7 @@ module app.yhyue.com/moapp/jy_docs
 go 1.14
 go 1.14
 
 
 require (
 require (
-	app.yhyue.com/moapp/jybase v0.0.0-20210317020927-18b0165f5ff9
+	app.yhyue.com/moapp/jybase v0.0.0-20210318061912-f5594310c8fe
 	app.yhyue.com/moapp/jyfs v0.0.0-20210309070327-ecad67beabb8
 	app.yhyue.com/moapp/jyfs v0.0.0-20210309070327-ecad67beabb8
 	github.com/golang/protobuf v1.4.3
 	github.com/golang/protobuf v1.4.3
 	github.com/mailru/easyjson v0.7.7 // indirect
 	github.com/mailru/easyjson v0.7.7 // indirect

+ 6 - 2
go.sum

@@ -1,5 +1,9 @@
-app.yhyue.com/moapp/jybase v0.0.0-20210317020927-18b0165f5ff9 h1:LVIuqXMqcclMwBbSmqEzXi0nIEiir+a2GpWAqksmfzk=
-app.yhyue.com/moapp/jybase v0.0.0-20210317020927-18b0165f5ff9/go.mod h1:29ShuI8y7qEyg2KviHSx1iamiCioBKdTMm2ndVzWAhk=
+app.yhyue.com/moapp/jybase v0.0.0-20210318032317-ab11de8dcc0a h1:wf7zDnDMHTmQCjnrOY4hS0EHZ8Ya5GQq7OOCS9NfCOA=
+app.yhyue.com/moapp/jybase v0.0.0-20210318032317-ab11de8dcc0a/go.mod h1:29ShuI8y7qEyg2KviHSx1iamiCioBKdTMm2ndVzWAhk=
+app.yhyue.com/moapp/jybase v0.0.0-20210318054150-8c129a033242 h1:5n4QJzwewnzSkU6USSTLiw+9doGn0rojstiIIjzzPU4=
+app.yhyue.com/moapp/jybase v0.0.0-20210318054150-8c129a033242/go.mod h1:29ShuI8y7qEyg2KviHSx1iamiCioBKdTMm2ndVzWAhk=
+app.yhyue.com/moapp/jybase v0.0.0-20210318061912-f5594310c8fe h1:RSQIrriyi534CCrI/sSLGW+Rd0X/0W4VDDXIalHVo8c=
+app.yhyue.com/moapp/jybase v0.0.0-20210318061912-f5594310c8fe/go.mod h1:29ShuI8y7qEyg2KviHSx1iamiCioBKdTMm2ndVzWAhk=
 app.yhyue.com/moapp/jyfs v0.0.0-20210309070327-ecad67beabb8 h1:Mg5E4O+5mCjRyW2b4/bNRQMz8ilzWfa7qaOjKT7SNRY=
 app.yhyue.com/moapp/jyfs v0.0.0-20210309070327-ecad67beabb8 h1:Mg5E4O+5mCjRyW2b4/bNRQMz8ilzWfa7qaOjKT7SNRY=
 app.yhyue.com/moapp/jyfs v0.0.0-20210309070327-ecad67beabb8/go.mod h1:iflE6z/Ee5f7YZy2DSj7S6asyL1yCbu3BjK/xMYMiDY=
 app.yhyue.com/moapp/jyfs v0.0.0-20210309070327-ecad67beabb8/go.mod h1:iflE6z/Ee5f7YZy2DSj7S6asyL1yCbu3BjK/xMYMiDY=
 github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
 github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=

+ 24 - 24
rpc/stdlib/internal/logic/docquerylogic.go

@@ -2,12 +2,12 @@ package logic
 
 
 import (
 import (
 	"context"
 	"context"
+	"fmt"
+	"strings"
 
 
 	"app.yhyue.com/moapp/jy_docs/rpc/stdlib/internal/svc"
 	"app.yhyue.com/moapp/jy_docs/rpc/stdlib/internal/svc"
 	"app.yhyue.com/moapp/jy_docs/rpc/stdlib/stdlib"
 	"app.yhyue.com/moapp/jy_docs/rpc/stdlib/stdlib"
 	stdlibService "app.yhyue.com/moapp/jy_docs/services/stdlib"
 	stdlibService "app.yhyue.com/moapp/jy_docs/services/stdlib"
-	"app.yhyue.com/moapp/jy_docs/services/util"
-	"app.yhyue.com/moapp/jybase/common"
 	"github.com/tal-tech/go-zero/core/logx"
 	"github.com/tal-tech/go-zero/core/logx"
 )
 )
 
 
@@ -17,6 +17,14 @@ type DocQueryLogic struct {
 	logx.Logger
 	logx.Logger
 }
 }
 
 
+var (
+	QuerySort = map[string]bool{
+		"uploadDate": true,
+		"viewTimes":  true,
+		"downTimes":  true,
+	}
+)
+
 func NewDocQueryLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DocQueryLogic {
 func NewDocQueryLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DocQueryLogic {
 	return &DocQueryLogic{
 	return &DocQueryLogic{
 		ctx:    ctx,
 		ctx:    ctx,
@@ -26,30 +34,22 @@ func NewDocQueryLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DocQuery
 }
 }
 
 
 func (l *DocQueryLogic) DocQuery(in *stdlib.DocQueryRequest) (*stdlib.DocQueryResponse, error) {
 func (l *DocQueryLogic) DocQuery(in *stdlib.DocQueryRequest) (*stdlib.DocQueryResponse, error) {
-	if in.PageNum <= 1 {
+	if in.PageNum < 1 {
 		in.PageNum = 1
 		in.PageNum = 1
 	}
 	}
-	total, list := stdlibService.FindDocumentsByKeyWords(in.KeyWord, in.DocClass, in.DocTag, in.UpdateDateSort, in.DownloadSort, in.ViewSort, in.PageNum, in.PageSize)
-	docs := []*stdlib.Doc{}
-	if list != nil {
-		for _, v := range *list {
-			docs = append(docs, &stdlib.Doc{
-				DocId:       common.ObjToString(v["id"]),
-				DocName:     common.ObjToString(v["docName"]),
-				Price:       common.Int64All(v["price"]),
-				DocPageSize: common.Int64All(v["docPageSize"]),
-				DocFileSize: common.Int64All(v["docFileSize"]),
-				DownTimes:   common.Int64All(v["downTimes"]),
-				ViewTimes:   common.Int64All(v["viewTimes"]),
-				UploadDate:  common.ObjToString(v["uploadDate"]),
-				DocSummary:  common.ObjToString(v["docSummary"]),
-				DocFileType: util.DocFileType[common.IntAll(v["docFileType"])],
-			})
+	if in.UserId != "" && in.AppId == "" {
+		return &stdlib.DocQueryResponse{
+			Code: 0,
+			Msg:  "缺少参数appId",
+		}, nil
+	}
+	for _, v := range in.Sort {
+		if !QuerySort[v] && !QuerySort[strings.TrimLeft(v, "-")] {
+			return &stdlib.DocQueryResponse{
+				Code: 0,
+				Msg:  fmt.Sprintf("sort数组中%s值不合法", v),
+			}, nil
 		}
 		}
 	}
 	}
-	return &stdlib.DocQueryResponse{
-		Total: total,
-		Docs:  docs,
-		Code:  1,
-	}, nil
+	return stdlibService.DocQuery(in), nil
 }
 }

+ 4 - 4
rpc/stdlib/stdlib.proto

@@ -8,10 +8,9 @@ message DocQueryRequest {
   string keyWord = 3; //检索词  文档名检索  模糊
   string keyWord = 3; //检索词  文档名检索  模糊
   repeated string docClass = 4;  // 分类 []string
   repeated string docClass = 4;  // 分类 []string
   repeated string docTag = 5;  // 标签 []string
   repeated string docTag = 5;  // 标签 []string
-  int64 updateDateSort = 6;  // 上传时间排序 1正序 -1倒序
-  int64 downloadSort = 7;    // 下载次数排序 1正序 -1倒序
-  int64  viewSort = 8;      // 浏览量排序 1正序 -1倒序
-  string userId = 9; //用户id
+  repeated string sort = 6; //默认正序,倒序字段前加-,uploadDate:上架时间 viewTimes:浏览量 downTimes:下载量
+  string userId = 7; //用户id
+  string appId = 8; //appId
 }
 }
 
 
 message DocQueryResponse {
 message DocQueryResponse {
@@ -32,6 +31,7 @@ message Doc {
   string uploadDate = 8;//上传时间
   string uploadDate = 8;//上传时间
   string docSummary = 9; //摘要
   string docSummary = 9; //摘要
   string docFileType = 10;//文档类型
   string docFileType = 10;//文档类型
+  int64 isDownload = 11;//是否转存 0:未转存 1:转存
 }
 }
 
 
 message DocChangeReq {
 message DocChangeReq {

+ 146 - 148
rpc/stdlib/stdlib/stdlib.pb.go

@@ -34,15 +34,14 @@ type DocQueryRequest struct {
 	sizeCache     protoimpl.SizeCache
 	sizeCache     protoimpl.SizeCache
 	unknownFields protoimpl.UnknownFields
 	unknownFields protoimpl.UnknownFields
 
 
-	PageNum        int64    `protobuf:"varint,1,opt,name=pageNum,proto3" json:"pageNum,omitempty"`               //页码
-	PageSize       int64    `protobuf:"varint,2,opt,name=pageSize,proto3" json:"pageSize,omitempty"`             //每页数量
-	KeyWord        string   `protobuf:"bytes,3,opt,name=keyWord,proto3" json:"keyWord,omitempty"`                //检索词  文档名检索  模糊
-	DocClass       []string `protobuf:"bytes,4,rep,name=docClass,proto3" json:"docClass,omitempty"`              // 分类 []string
-	DocTag         []string `protobuf:"bytes,5,rep,name=docTag,proto3" json:"docTag,omitempty"`                  // 标签 []string
-	UpdateDateSort int64    `protobuf:"varint,6,opt,name=updateDateSort,proto3" json:"updateDateSort,omitempty"` // 上传时间排序 1正序 -1倒序
-	DownloadSort   int64    `protobuf:"varint,7,opt,name=downloadSort,proto3" json:"downloadSort,omitempty"`     // 下载次数排序 1正序 -1倒序
-	ViewSort       int64    `protobuf:"varint,8,opt,name=viewSort,proto3" json:"viewSort,omitempty"`             // 浏览量排序 1正序 -1倒序
-	UserId         string   `protobuf:"bytes,9,opt,name=userId,proto3" json:"userId,omitempty"`                  //用户id
+	PageNum  int64    `protobuf:"varint,1,opt,name=pageNum,proto3" json:"pageNum,omitempty"`   //页码
+	PageSize int64    `protobuf:"varint,2,opt,name=pageSize,proto3" json:"pageSize,omitempty"` //每页数量
+	KeyWord  string   `protobuf:"bytes,3,opt,name=keyWord,proto3" json:"keyWord,omitempty"`    //检索词  文档名检索  模糊
+	DocClass []string `protobuf:"bytes,4,rep,name=docClass,proto3" json:"docClass,omitempty"`  // 分类 []string
+	DocTag   []string `protobuf:"bytes,5,rep,name=docTag,proto3" json:"docTag,omitempty"`      // 标签 []string
+	Sort     []string `protobuf:"bytes,6,rep,name=sort,proto3" json:"sort,omitempty"`          //默认正序,倒序字段前加-,uploadDate:上架时间 viewTimes:浏览量 downTimes:下载量
+	UserId   string   `protobuf:"bytes,7,opt,name=userId,proto3" json:"userId,omitempty"`      //用户id
+	AppId    string   `protobuf:"bytes,8,opt,name=appId,proto3" json:"appId,omitempty"`        //appId
 }
 }
 
 
 func (x *DocQueryRequest) Reset() {
 func (x *DocQueryRequest) Reset() {
@@ -112,30 +111,23 @@ func (x *DocQueryRequest) GetDocTag() []string {
 	return nil
 	return nil
 }
 }
 
 
-func (x *DocQueryRequest) GetUpdateDateSort() int64 {
+func (x *DocQueryRequest) GetSort() []string {
 	if x != nil {
 	if x != nil {
-		return x.UpdateDateSort
+		return x.Sort
 	}
 	}
-	return 0
+	return nil
 }
 }
 
 
-func (x *DocQueryRequest) GetDownloadSort() int64 {
+func (x *DocQueryRequest) GetUserId() string {
 	if x != nil {
 	if x != nil {
-		return x.DownloadSort
+		return x.UserId
 	}
 	}
-	return 0
+	return ""
 }
 }
 
 
-func (x *DocQueryRequest) GetViewSort() int64 {
+func (x *DocQueryRequest) GetAppId() string {
 	if x != nil {
 	if x != nil {
-		return x.ViewSort
-	}
-	return 0
-}
-
-func (x *DocQueryRequest) GetUserId() string {
-	if x != nil {
-		return x.UserId
+		return x.AppId
 	}
 	}
 	return ""
 	return ""
 }
 }
@@ -226,6 +218,7 @@ type Doc struct {
 	UploadDate  string `protobuf:"bytes,8,opt,name=uploadDate,proto3" json:"uploadDate,omitempty"`    //上传时间
 	UploadDate  string `protobuf:"bytes,8,opt,name=uploadDate,proto3" json:"uploadDate,omitempty"`    //上传时间
 	DocSummary  string `protobuf:"bytes,9,opt,name=docSummary,proto3" json:"docSummary,omitempty"`    //摘要
 	DocSummary  string `protobuf:"bytes,9,opt,name=docSummary,proto3" json:"docSummary,omitempty"`    //摘要
 	DocFileType string `protobuf:"bytes,10,opt,name=docFileType,proto3" json:"docFileType,omitempty"` //文档类型
 	DocFileType string `protobuf:"bytes,10,opt,name=docFileType,proto3" json:"docFileType,omitempty"` //文档类型
+	IsDownload  int64  `protobuf:"varint,11,opt,name=isDownload,proto3" json:"isDownload,omitempty"`  //是否转存 0:未转存 1:转存
 }
 }
 
 
 func (x *Doc) Reset() {
 func (x *Doc) Reset() {
@@ -330,6 +323,13 @@ func (x *Doc) GetDocFileType() string {
 	return ""
 	return ""
 }
 }
 
 
+func (x *Doc) GetIsDownload() int64 {
+	if x != nil {
+		return x.IsDownload
+	}
+	return 0
+}
+
 type DocChangeReq struct {
 type DocChangeReq struct {
 	state         protoimpl.MessageState
 	state         protoimpl.MessageState
 	sizeCache     protoimpl.SizeCache
 	sizeCache     protoimpl.SizeCache
@@ -949,7 +949,7 @@ var File_stdlib_proto protoreflect.FileDescriptor
 
 
 var file_stdlib_proto_rawDesc = []byte{
 var file_stdlib_proto_rawDesc = []byte{
 	0x0a, 0x0c, 0x73, 0x74, 0x64, 0x6c, 0x69, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x06,
 	0x0a, 0x0c, 0x73, 0x74, 0x64, 0x6c, 0x69, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x06,
-	0x73, 0x74, 0x64, 0x6c, 0x69, 0x62, 0x22, 0x95, 0x02, 0x0a, 0x0f, 0x44, 0x6f, 0x63, 0x51, 0x75,
+	0x73, 0x74, 0x64, 0x6c, 0x69, 0x62, 0x22, 0xd7, 0x01, 0x0a, 0x0f, 0x44, 0x6f, 0x63, 0x51, 0x75,
 	0x65, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x61,
 	0x65, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x61,
 	0x67, 0x65, 0x4e, 0x75, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x70, 0x61, 0x67,
 	0x67, 0x65, 0x4e, 0x75, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x70, 0x61, 0x67,
 	0x65, 0x4e, 0x75, 0x6d, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x61, 0x67, 0x65, 0x53, 0x69, 0x7a, 0x65,
 	0x65, 0x4e, 0x75, 0x6d, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x61, 0x67, 0x65, 0x53, 0x69, 0x7a, 0x65,
@@ -958,133 +958,131 @@ var file_stdlib_proto_rawDesc = []byte{
 	0x09, 0x52, 0x07, 0x6b, 0x65, 0x79, 0x57, 0x6f, 0x72, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x64, 0x6f,
 	0x09, 0x52, 0x07, 0x6b, 0x65, 0x79, 0x57, 0x6f, 0x72, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x64, 0x6f,
 	0x63, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x64, 0x6f,
 	0x63, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x64, 0x6f,
 	0x63, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x64, 0x6f, 0x63, 0x54, 0x61, 0x67,
 	0x63, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x64, 0x6f, 0x63, 0x54, 0x61, 0x67,
-	0x18, 0x05, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x64, 0x6f, 0x63, 0x54, 0x61, 0x67, 0x12, 0x26,
-	0x0a, 0x0e, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x44, 0x61, 0x74, 0x65, 0x53, 0x6f, 0x72, 0x74,
-	0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0e, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x44, 0x61,
-	0x74, 0x65, 0x53, 0x6f, 0x72, 0x74, 0x12, 0x22, 0x0a, 0x0c, 0x64, 0x6f, 0x77, 0x6e, 0x6c, 0x6f,
-	0x61, 0x64, 0x53, 0x6f, 0x72, 0x74, 0x18, 0x07, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0c, 0x64, 0x6f,
-	0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x53, 0x6f, 0x72, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x76, 0x69,
-	0x65, 0x77, 0x53, 0x6f, 0x72, 0x74, 0x18, 0x08, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x76, 0x69,
-	0x65, 0x77, 0x53, 0x6f, 0x72, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64,
-	0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x22, 0x6f,
-	0x0a, 0x10, 0x44, 0x6f, 0x63, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
-	0x73, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03,
+	0x18, 0x05, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x64, 0x6f, 0x63, 0x54, 0x61, 0x67, 0x12, 0x12,
+	0x0a, 0x04, 0x73, 0x6f, 0x72, 0x74, 0x18, 0x06, 0x20, 0x03, 0x28, 0x09, 0x52, 0x04, 0x73, 0x6f,
+	0x72, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x18, 0x07, 0x20, 0x01,
+	0x28, 0x09, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x61, 0x70,
+	0x70, 0x49, 0x64, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x61, 0x70, 0x70, 0x49, 0x64,
+	0x22, 0x6f, 0x0a, 0x10, 0x44, 0x6f, 0x63, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70,
+	0x6f, 0x6e, 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01,
+	0x28, 0x03, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x6d, 0x73, 0x67, 0x18,
+	0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6d, 0x73, 0x67, 0x12, 0x1f, 0x0a, 0x04, 0x64, 0x6f,
+	0x63, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x73, 0x74, 0x64, 0x6c, 0x69,
+	0x62, 0x2e, 0x44, 0x6f, 0x63, 0x52, 0x04, 0x64, 0x6f, 0x63, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x74,
+	0x6f, 0x74, 0x61, 0x6c, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x74, 0x6f, 0x74, 0x61,
+	0x6c, 0x22, 0xcd, 0x02, 0x0a, 0x03, 0x44, 0x6f, 0x63, 0x12, 0x14, 0x0a, 0x05, 0x64, 0x6f, 0x63,
+	0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x64, 0x6f, 0x63, 0x49, 0x64, 0x12,
+	0x18, 0x0a, 0x07, 0x64, 0x6f, 0x63, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09,
+	0x52, 0x07, 0x64, 0x6f, 0x63, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x70, 0x72, 0x69,
+	0x63, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x70, 0x72, 0x69, 0x63, 0x65, 0x12,
+	0x20, 0x0a, 0x0b, 0x64, 0x6f, 0x63, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x18, 0x04,
+	0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x64, 0x6f, 0x63, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x69, 0x7a,
+	0x65, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x6f, 0x63, 0x50, 0x61, 0x67, 0x65, 0x53, 0x69, 0x7a, 0x65,
+	0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x64, 0x6f, 0x63, 0x50, 0x61, 0x67, 0x65, 0x53,
+	0x69, 0x7a, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x64, 0x6f, 0x77, 0x6e, 0x54, 0x69, 0x6d, 0x65, 0x73,
+	0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x64, 0x6f, 0x77, 0x6e, 0x54, 0x69, 0x6d, 0x65,
+	0x73, 0x12, 0x1c, 0x0a, 0x09, 0x76, 0x69, 0x65, 0x77, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x18, 0x07,
+	0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x76, 0x69, 0x65, 0x77, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x12,
+	0x1e, 0x0a, 0x0a, 0x75, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x44, 0x61, 0x74, 0x65, 0x18, 0x08, 0x20,
+	0x01, 0x28, 0x09, 0x52, 0x0a, 0x75, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x44, 0x61, 0x74, 0x65, 0x12,
+	0x1e, 0x0a, 0x0a, 0x64, 0x6f, 0x63, 0x53, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x18, 0x09, 0x20,
+	0x01, 0x28, 0x09, 0x52, 0x0a, 0x64, 0x6f, 0x63, 0x53, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x12,
+	0x20, 0x0a, 0x0b, 0x64, 0x6f, 0x63, 0x46, 0x69, 0x6c, 0x65, 0x54, 0x79, 0x70, 0x65, 0x18, 0x0a,
+	0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x6f, 0x63, 0x46, 0x69, 0x6c, 0x65, 0x54, 0x79, 0x70,
+	0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x69, 0x73, 0x44, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x18,
+	0x0b, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x69, 0x73, 0x44, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61,
+	0x64, 0x22, 0x4c, 0x0a, 0x0c, 0x44, 0x6f, 0x63, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x65,
+	0x71, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69,
+	0x64, 0x12, 0x16, 0x0a, 0x06, 0x72, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28,
+	0x05, 0x52, 0x06, 0x72, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x12, 0x14, 0x0a, 0x05, 0x61, 0x70, 0x70,
+	0x49, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x61, 0x70, 0x70, 0x49, 0x64, 0x22,
+	0x25, 0x0a, 0x0d, 0x44, 0x6f, 0x63, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70,
+	0x12, 0x14, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52,
+	0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x22, 0x56, 0x0a, 0x10, 0x44, 0x6f, 0x63, 0x53, 0x74, 0x61,
+	0x74, 0x69, 0x73, 0x74, 0x69, 0x63, 0x73, 0x52, 0x65, 0x71, 0x12, 0x14, 0x0a, 0x05, 0x64, 0x6f,
+	0x63, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x64, 0x6f, 0x63, 0x49, 0x64,
+	0x12, 0x2c, 0x0a, 0x11, 0x44, 0x6f, 0x63, 0x53, 0x74, 0x61, 0x74, 0x69, 0x73, 0x74, 0x69, 0x63,
+	0x73, 0x54, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x11, 0x44, 0x6f, 0x63,
+	0x53, 0x74, 0x61, 0x74, 0x69, 0x73, 0x74, 0x69, 0x63, 0x73, 0x54, 0x79, 0x70, 0x65, 0x22, 0x3e,
+	0x0a, 0x0e, 0x44, 0x6f, 0x63, 0x47, 0x65, 0x74, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x71,
+	0x12, 0x14, 0x0a, 0x05, 0x64, 0x6f, 0x63, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52,
+	0x05, 0x64, 0x6f, 0x63, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64,
+	0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x22, 0xfb,
+	0x01, 0x0a, 0x0f, 0x44, 0x6f, 0x63, 0x47, 0x65, 0x74, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65,
+	0x73, 0x70, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05,
 	0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x6d, 0x73, 0x67, 0x18, 0x02, 0x20,
 	0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x6d, 0x73, 0x67, 0x18, 0x02, 0x20,
-	0x01, 0x28, 0x09, 0x52, 0x03, 0x6d, 0x73, 0x67, 0x12, 0x1f, 0x0a, 0x04, 0x64, 0x6f, 0x63, 0x73,
-	0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x73, 0x74, 0x64, 0x6c, 0x69, 0x62, 0x2e,
-	0x44, 0x6f, 0x63, 0x52, 0x04, 0x64, 0x6f, 0x63, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x74,
-	0x61, 0x6c, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x22,
-	0xad, 0x02, 0x0a, 0x03, 0x44, 0x6f, 0x63, 0x12, 0x14, 0x0a, 0x05, 0x64, 0x6f, 0x63, 0x49, 0x64,
-	0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x64, 0x6f, 0x63, 0x49, 0x64, 0x12, 0x18, 0x0a,
-	0x07, 0x64, 0x6f, 0x63, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07,
-	0x64, 0x6f, 0x63, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x70, 0x72, 0x69, 0x63, 0x65,
-	0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x70, 0x72, 0x69, 0x63, 0x65, 0x12, 0x20, 0x0a,
-	0x0b, 0x64, 0x6f, 0x63, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x18, 0x04, 0x20, 0x01,
-	0x28, 0x03, 0x52, 0x0b, 0x64, 0x6f, 0x63, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x12,
-	0x20, 0x0a, 0x0b, 0x64, 0x6f, 0x63, 0x50, 0x61, 0x67, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x18, 0x05,
-	0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x64, 0x6f, 0x63, 0x50, 0x61, 0x67, 0x65, 0x53, 0x69, 0x7a,
-	0x65, 0x12, 0x1c, 0x0a, 0x09, 0x64, 0x6f, 0x77, 0x6e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x18, 0x06,
-	0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x64, 0x6f, 0x77, 0x6e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x12,
-	0x1c, 0x0a, 0x09, 0x76, 0x69, 0x65, 0x77, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x18, 0x07, 0x20, 0x01,
-	0x28, 0x03, 0x52, 0x09, 0x76, 0x69, 0x65, 0x77, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x12, 0x1e, 0x0a,
-	0x0a, 0x75, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x44, 0x61, 0x74, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28,
-	0x09, 0x52, 0x0a, 0x75, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x44, 0x61, 0x74, 0x65, 0x12, 0x1e, 0x0a,
-	0x0a, 0x64, 0x6f, 0x63, 0x53, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x18, 0x09, 0x20, 0x01, 0x28,
-	0x09, 0x52, 0x0a, 0x64, 0x6f, 0x63, 0x53, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x12, 0x20, 0x0a,
-	0x0b, 0x64, 0x6f, 0x63, 0x46, 0x69, 0x6c, 0x65, 0x54, 0x79, 0x70, 0x65, 0x18, 0x0a, 0x20, 0x01,
-	0x28, 0x09, 0x52, 0x0b, 0x64, 0x6f, 0x63, 0x46, 0x69, 0x6c, 0x65, 0x54, 0x79, 0x70, 0x65, 0x22,
-	0x4c, 0x0a, 0x0c, 0x44, 0x6f, 0x63, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x65, 0x71, 0x12,
-	0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12,
-	0x16, 0x0a, 0x06, 0x72, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52,
-	0x06, 0x72, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x12, 0x14, 0x0a, 0x05, 0x61, 0x70, 0x70, 0x49, 0x64,
-	0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x61, 0x70, 0x70, 0x49, 0x64, 0x22, 0x25, 0x0a,
-	0x0d, 0x44, 0x6f, 0x63, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x12, 0x14,
-	0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x73,
-	0x74, 0x61, 0x74, 0x65, 0x22, 0x56, 0x0a, 0x10, 0x44, 0x6f, 0x63, 0x53, 0x74, 0x61, 0x74, 0x69,
-	0x73, 0x74, 0x69, 0x63, 0x73, 0x52, 0x65, 0x71, 0x12, 0x14, 0x0a, 0x05, 0x64, 0x6f, 0x63, 0x49,
-	0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x64, 0x6f, 0x63, 0x49, 0x64, 0x12, 0x2c,
-	0x0a, 0x11, 0x44, 0x6f, 0x63, 0x53, 0x74, 0x61, 0x74, 0x69, 0x73, 0x74, 0x69, 0x63, 0x73, 0x54,
-	0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x11, 0x44, 0x6f, 0x63, 0x53, 0x74,
-	0x61, 0x74, 0x69, 0x73, 0x74, 0x69, 0x63, 0x73, 0x54, 0x79, 0x70, 0x65, 0x22, 0x3e, 0x0a, 0x0e,
-	0x44, 0x6f, 0x63, 0x47, 0x65, 0x74, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x12, 0x14,
-	0x0a, 0x05, 0x64, 0x6f, 0x63, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x64,
-	0x6f, 0x63, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x18, 0x02,
-	0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x22, 0xfb, 0x01, 0x0a,
-	0x0f, 0x44, 0x6f, 0x63, 0x47, 0x65, 0x74, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70,
+	0x01, 0x28, 0x09, 0x52, 0x03, 0x6d, 0x73, 0x67, 0x12, 0x18, 0x0a, 0x07, 0x64, 0x6f, 0x63, 0x4e,
+	0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x64, 0x6f, 0x63, 0x4e, 0x61,
+	0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x64, 0x6f, 0x63, 0x54, 0x79, 0x70, 0x65, 0x18, 0x04, 0x20,
+	0x01, 0x28, 0x05, 0x52, 0x07, 0x64, 0x6f, 0x63, 0x54, 0x79, 0x70, 0x65, 0x12, 0x20, 0x0a, 0x0b,
+	0x64, 0x6f, 0x63, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28,
+	0x05, 0x52, 0x0b, 0x64, 0x6f, 0x63, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x20,
+	0x0a, 0x0b, 0x64, 0x6f, 0x63, 0x50, 0x61, 0x67, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x18, 0x06, 0x20,
+	0x01, 0x28, 0x05, 0x52, 0x0b, 0x64, 0x6f, 0x63, 0x50, 0x61, 0x67, 0x65, 0x53, 0x69, 0x7a, 0x65,
+	0x12, 0x12, 0x0a, 0x04, 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04,
+	0x74, 0x61, 0x67, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x18, 0x08,
+	0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x1e, 0x0a, 0x0a,
+	0x64, 0x6f, 0x63, 0x53, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09,
+	0x52, 0x0a, 0x64, 0x6f, 0x63, 0x53, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x22, 0x59, 0x0a, 0x11,
+	0x44, 0x6f, 0x63, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73,
+	0x70, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52,
+	0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x6d, 0x73, 0x67, 0x18, 0x02, 0x20, 0x01,
+	0x28, 0x09, 0x52, 0x03, 0x6d, 0x73, 0x67, 0x12, 0x1e, 0x0a, 0x0a, 0x64, 0x6f, 0x63, 0x43, 0x6f,
+	0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0a, 0x64, 0x6f, 0x63,
+	0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x22, 0x46, 0x0a, 0x0e, 0x44, 0x6f, 0x63, 0x41, 0x63,
+	0x74, 0x69, 0x76, 0x69, 0x74, 0x79, 0x52, 0x65, 0x71, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x61, 0x67,
+	0x65, 0x4e, 0x75, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x70, 0x61, 0x67, 0x65,
+	0x4e, 0x75, 0x6d, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x61, 0x67, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x18,
+	0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x70, 0x61, 0x67, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x22,
+	0xcb, 0x01, 0x0a, 0x0b, 0x44, 0x6f, 0x63, 0x41, 0x63, 0x74, 0x69, 0x76, 0x69, 0x74, 0x79, 0x12,
+	0x14, 0x0a, 0x05, 0x64, 0x6f, 0x63, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05,
+	0x64, 0x6f, 0x63, 0x49, 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x61, 0x63, 0x74, 0x69, 0x76, 0x69, 0x74,
+	0x79, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x61, 0x63, 0x74, 0x69, 0x76,
+	0x69, 0x74, 0x79, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x64, 0x6f, 0x63, 0x54, 0x69, 0x74, 0x6c,
+	0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x64, 0x6f, 0x63, 0x54, 0x69, 0x74, 0x6c,
+	0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x64, 0x6f, 0x63, 0x53, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x18,
+	0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x64, 0x6f, 0x63, 0x53, 0x75, 0x6d, 0x6d, 0x61, 0x72,
+	0x79, 0x12, 0x16, 0x0a, 0x06, 0x64, 0x6f, 0x63, 0x49, 0x6d, 0x67, 0x18, 0x05, 0x20, 0x01, 0x28,
+	0x09, 0x52, 0x06, 0x64, 0x6f, 0x63, 0x49, 0x6d, 0x67, 0x12, 0x14, 0x0a, 0x05, 0x70, 0x72, 0x69,
+	0x63, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x70, 0x72, 0x69, 0x63, 0x65, 0x12,
+	0x1c, 0x0a, 0x09, 0x63, 0x6f, 0x73, 0x74, 0x50, 0x72, 0x69, 0x63, 0x65, 0x18, 0x07, 0x20, 0x01,
+	0x28, 0x05, 0x52, 0x09, 0x63, 0x6f, 0x73, 0x74, 0x50, 0x72, 0x69, 0x63, 0x65, 0x22, 0x76, 0x0a,
+	0x0f, 0x44, 0x6f, 0x63, 0x41, 0x63, 0x74, 0x69, 0x76, 0x69, 0x74, 0x79, 0x52, 0x65, 0x73, 0x70,
 	0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04,
 	0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04,
 	0x63, 0x6f, 0x64, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x6d, 0x73, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28,
 	0x63, 0x6f, 0x64, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x6d, 0x73, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28,
-	0x09, 0x52, 0x03, 0x6d, 0x73, 0x67, 0x12, 0x18, 0x0a, 0x07, 0x64, 0x6f, 0x63, 0x4e, 0x61, 0x6d,
-	0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x64, 0x6f, 0x63, 0x4e, 0x61, 0x6d, 0x65,
-	0x12, 0x18, 0x0a, 0x07, 0x64, 0x6f, 0x63, 0x54, 0x79, 0x70, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28,
-	0x05, 0x52, 0x07, 0x64, 0x6f, 0x63, 0x54, 0x79, 0x70, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x6f,
-	0x63, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52,
-	0x0b, 0x64, 0x6f, 0x63, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x20, 0x0a, 0x0b,
-	0x64, 0x6f, 0x63, 0x50, 0x61, 0x67, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28,
-	0x05, 0x52, 0x0b, 0x64, 0x6f, 0x63, 0x50, 0x61, 0x67, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x12,
-	0x0a, 0x04, 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x61,
-	0x67, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x18, 0x08, 0x20, 0x01,
-	0x28, 0x09, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x64, 0x6f,
-	0x63, 0x53, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a,
-	0x64, 0x6f, 0x63, 0x53, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x22, 0x59, 0x0a, 0x11, 0x44, 0x6f,
-	0x63, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12,
-	0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x63,
-	0x6f, 0x64, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x6d, 0x73, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09,
-	0x52, 0x03, 0x6d, 0x73, 0x67, 0x12, 0x1e, 0x0a, 0x0a, 0x64, 0x6f, 0x63, 0x43, 0x6f, 0x6e, 0x74,
-	0x65, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0a, 0x64, 0x6f, 0x63, 0x43, 0x6f,
-	0x6e, 0x74, 0x65, 0x6e, 0x74, 0x22, 0x46, 0x0a, 0x0e, 0x44, 0x6f, 0x63, 0x41, 0x63, 0x74, 0x69,
-	0x76, 0x69, 0x74, 0x79, 0x52, 0x65, 0x71, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x61, 0x67, 0x65, 0x4e,
-	0x75, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x70, 0x61, 0x67, 0x65, 0x4e, 0x75,
-	0x6d, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x61, 0x67, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x18, 0x02, 0x20,
-	0x01, 0x28, 0x05, 0x52, 0x08, 0x70, 0x61, 0x67, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x22, 0xcb, 0x01,
-	0x0a, 0x0b, 0x44, 0x6f, 0x63, 0x41, 0x63, 0x74, 0x69, 0x76, 0x69, 0x74, 0x79, 0x12, 0x14, 0x0a,
-	0x05, 0x64, 0x6f, 0x63, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x64, 0x6f,
-	0x63, 0x49, 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x61, 0x63, 0x74, 0x69, 0x76, 0x69, 0x74, 0x79, 0x49,
-	0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x61, 0x63, 0x74, 0x69, 0x76, 0x69, 0x74,
-	0x79, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x64, 0x6f, 0x63, 0x54, 0x69, 0x74, 0x6c, 0x65, 0x18,
-	0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x64, 0x6f, 0x63, 0x54, 0x69, 0x74, 0x6c, 0x65, 0x12,
-	0x1e, 0x0a, 0x0a, 0x64, 0x6f, 0x63, 0x53, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x18, 0x04, 0x20,
-	0x01, 0x28, 0x09, 0x52, 0x0a, 0x64, 0x6f, 0x63, 0x53, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x12,
-	0x16, 0x0a, 0x06, 0x64, 0x6f, 0x63, 0x49, 0x6d, 0x67, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52,
-	0x06, 0x64, 0x6f, 0x63, 0x49, 0x6d, 0x67, 0x12, 0x14, 0x0a, 0x05, 0x70, 0x72, 0x69, 0x63, 0x65,
-	0x18, 0x06, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x70, 0x72, 0x69, 0x63, 0x65, 0x12, 0x1c, 0x0a,
-	0x09, 0x63, 0x6f, 0x73, 0x74, 0x50, 0x72, 0x69, 0x63, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x05,
-	0x52, 0x09, 0x63, 0x6f, 0x73, 0x74, 0x50, 0x72, 0x69, 0x63, 0x65, 0x22, 0x76, 0x0a, 0x0f, 0x44,
-	0x6f, 0x63, 0x41, 0x63, 0x74, 0x69, 0x76, 0x69, 0x74, 0x79, 0x52, 0x65, 0x73, 0x70, 0x12, 0x12,
-	0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x63, 0x6f,
-	0x64, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x6d, 0x73, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52,
-	0x03, 0x6d, 0x73, 0x67, 0x12, 0x27, 0x0a, 0x04, 0x64, 0x6f, 0x63, 0x73, 0x18, 0x03, 0x20, 0x03,
-	0x28, 0x0b, 0x32, 0x13, 0x2e, 0x73, 0x74, 0x64, 0x6c, 0x69, 0x62, 0x2e, 0x44, 0x6f, 0x63, 0x41,
-	0x63, 0x74, 0x69, 0x76, 0x69, 0x74, 0x79, 0x52, 0x04, 0x64, 0x6f, 0x63, 0x73, 0x12, 0x14, 0x0a,
-	0x05, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x74, 0x6f,
-	0x74, 0x61, 0x6c, 0x32, 0xba, 0x03, 0x0a, 0x06, 0x53, 0x74, 0x64, 0x6c, 0x69, 0x62, 0x12, 0x3d,
-	0x0a, 0x08, 0x44, 0x6f, 0x63, 0x51, 0x75, 0x65, 0x72, 0x79, 0x12, 0x17, 0x2e, 0x73, 0x74, 0x64,
-	0x6c, 0x69, 0x62, 0x2e, 0x44, 0x6f, 0x63, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75,
-	0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x73, 0x74, 0x64, 0x6c, 0x69, 0x62, 0x2e, 0x44, 0x6f, 0x63,
-	0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x34, 0x0a,
-	0x05, 0x44, 0x6f, 0x63, 0x4f, 0x6e, 0x12, 0x14, 0x2e, 0x73, 0x74, 0x64, 0x6c, 0x69, 0x62, 0x2e,
-	0x44, 0x6f, 0x63, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x65, 0x71, 0x1a, 0x15, 0x2e, 0x73,
-	0x74, 0x64, 0x6c, 0x69, 0x62, 0x2e, 0x44, 0x6f, 0x63, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x52,
-	0x65, 0x73, 0x70, 0x12, 0x35, 0x0a, 0x06, 0x44, 0x6f, 0x63, 0x4f, 0x66, 0x66, 0x12, 0x14, 0x2e,
-	0x73, 0x74, 0x64, 0x6c, 0x69, 0x62, 0x2e, 0x44, 0x6f, 0x63, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65,
-	0x52, 0x65, 0x71, 0x1a, 0x15, 0x2e, 0x73, 0x74, 0x64, 0x6c, 0x69, 0x62, 0x2e, 0x44, 0x6f, 0x63,
-	0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x12, 0x40, 0x0a, 0x0d, 0x44, 0x6f,
-	0x63, 0x53, 0x74, 0x61, 0x74, 0x69, 0x73, 0x74, 0x69, 0x63, 0x73, 0x12, 0x18, 0x2e, 0x73, 0x74,
-	0x64, 0x6c, 0x69, 0x62, 0x2e, 0x44, 0x6f, 0x63, 0x53, 0x74, 0x61, 0x74, 0x69, 0x73, 0x74, 0x69,
-	0x63, 0x73, 0x52, 0x65, 0x71, 0x1a, 0x15, 0x2e, 0x73, 0x74, 0x64, 0x6c, 0x69, 0x62, 0x2e, 0x44,
-	0x6f, 0x63, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x12, 0x3e, 0x0a, 0x0b,
-	0x44, 0x6f, 0x63, 0x47, 0x65, 0x74, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x12, 0x16, 0x2e, 0x73, 0x74,
-	0x64, 0x6c, 0x69, 0x62, 0x2e, 0x44, 0x6f, 0x63, 0x47, 0x65, 0x74, 0x43, 0x68, 0x65, 0x63, 0x6b,
-	0x52, 0x65, 0x71, 0x1a, 0x17, 0x2e, 0x73, 0x74, 0x64, 0x6c, 0x69, 0x62, 0x2e, 0x44, 0x6f, 0x63,
-	0x47, 0x65, 0x74, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x12, 0x42, 0x0a, 0x0d,
-	0x44, 0x6f, 0x63, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x12, 0x16, 0x2e,
+	0x09, 0x52, 0x03, 0x6d, 0x73, 0x67, 0x12, 0x27, 0x0a, 0x04, 0x64, 0x6f, 0x63, 0x73, 0x18, 0x03,
+	0x20, 0x03, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x73, 0x74, 0x64, 0x6c, 0x69, 0x62, 0x2e, 0x44, 0x6f,
+	0x63, 0x41, 0x63, 0x74, 0x69, 0x76, 0x69, 0x74, 0x79, 0x52, 0x04, 0x64, 0x6f, 0x63, 0x73, 0x12,
+	0x14, 0x0a, 0x05, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05,
+	0x74, 0x6f, 0x74, 0x61, 0x6c, 0x32, 0xba, 0x03, 0x0a, 0x06, 0x53, 0x74, 0x64, 0x6c, 0x69, 0x62,
+	0x12, 0x3d, 0x0a, 0x08, 0x44, 0x6f, 0x63, 0x51, 0x75, 0x65, 0x72, 0x79, 0x12, 0x17, 0x2e, 0x73,
+	0x74, 0x64, 0x6c, 0x69, 0x62, 0x2e, 0x44, 0x6f, 0x63, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65,
+	0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x73, 0x74, 0x64, 0x6c, 0x69, 0x62, 0x2e, 0x44,
+	0x6f, 0x63, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12,
+	0x34, 0x0a, 0x05, 0x44, 0x6f, 0x63, 0x4f, 0x6e, 0x12, 0x14, 0x2e, 0x73, 0x74, 0x64, 0x6c, 0x69,
+	0x62, 0x2e, 0x44, 0x6f, 0x63, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x65, 0x71, 0x1a, 0x15,
+	0x2e, 0x73, 0x74, 0x64, 0x6c, 0x69, 0x62, 0x2e, 0x44, 0x6f, 0x63, 0x43, 0x68, 0x61, 0x6e, 0x67,
+	0x65, 0x52, 0x65, 0x73, 0x70, 0x12, 0x35, 0x0a, 0x06, 0x44, 0x6f, 0x63, 0x4f, 0x66, 0x66, 0x12,
+	0x14, 0x2e, 0x73, 0x74, 0x64, 0x6c, 0x69, 0x62, 0x2e, 0x44, 0x6f, 0x63, 0x43, 0x68, 0x61, 0x6e,
+	0x67, 0x65, 0x52, 0x65, 0x71, 0x1a, 0x15, 0x2e, 0x73, 0x74, 0x64, 0x6c, 0x69, 0x62, 0x2e, 0x44,
+	0x6f, 0x63, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x12, 0x40, 0x0a, 0x0d,
+	0x44, 0x6f, 0x63, 0x53, 0x74, 0x61, 0x74, 0x69, 0x73, 0x74, 0x69, 0x63, 0x73, 0x12, 0x18, 0x2e,
+	0x73, 0x74, 0x64, 0x6c, 0x69, 0x62, 0x2e, 0x44, 0x6f, 0x63, 0x53, 0x74, 0x61, 0x74, 0x69, 0x73,
+	0x74, 0x69, 0x63, 0x73, 0x52, 0x65, 0x71, 0x1a, 0x15, 0x2e, 0x73, 0x74, 0x64, 0x6c, 0x69, 0x62,
+	0x2e, 0x44, 0x6f, 0x63, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x12, 0x3e,
+	0x0a, 0x0b, 0x44, 0x6f, 0x63, 0x47, 0x65, 0x74, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x12, 0x16, 0x2e,
 	0x73, 0x74, 0x64, 0x6c, 0x69, 0x62, 0x2e, 0x44, 0x6f, 0x63, 0x47, 0x65, 0x74, 0x43, 0x68, 0x65,
 	0x73, 0x74, 0x64, 0x6c, 0x69, 0x62, 0x2e, 0x44, 0x6f, 0x63, 0x47, 0x65, 0x74, 0x43, 0x68, 0x65,
-	0x63, 0x6b, 0x52, 0x65, 0x71, 0x1a, 0x19, 0x2e, 0x73, 0x74, 0x64, 0x6c, 0x69, 0x62, 0x2e, 0x44,
-	0x6f, 0x63, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70,
-	0x12, 0x3e, 0x0a, 0x0b, 0x44, 0x6f, 0x63, 0x41, 0x63, 0x74, 0x69, 0x76, 0x69, 0x74, 0x79, 0x12,
-	0x16, 0x2e, 0x73, 0x74, 0x64, 0x6c, 0x69, 0x62, 0x2e, 0x44, 0x6f, 0x63, 0x41, 0x63, 0x74, 0x69,
-	0x76, 0x69, 0x74, 0x79, 0x52, 0x65, 0x71, 0x1a, 0x17, 0x2e, 0x73, 0x74, 0x64, 0x6c, 0x69, 0x62,
-	0x2e, 0x44, 0x6f, 0x63, 0x41, 0x63, 0x74, 0x69, 0x76, 0x69, 0x74, 0x79, 0x52, 0x65, 0x73, 0x70,
-	0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
+	0x63, 0x6b, 0x52, 0x65, 0x71, 0x1a, 0x17, 0x2e, 0x73, 0x74, 0x64, 0x6c, 0x69, 0x62, 0x2e, 0x44,
+	0x6f, 0x63, 0x47, 0x65, 0x74, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x12, 0x42,
+	0x0a, 0x0d, 0x44, 0x6f, 0x63, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x12,
+	0x16, 0x2e, 0x73, 0x74, 0x64, 0x6c, 0x69, 0x62, 0x2e, 0x44, 0x6f, 0x63, 0x47, 0x65, 0x74, 0x43,
+	0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x1a, 0x19, 0x2e, 0x73, 0x74, 0x64, 0x6c, 0x69, 0x62,
+	0x2e, 0x44, 0x6f, 0x63, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x52, 0x65,
+	0x73, 0x70, 0x12, 0x3e, 0x0a, 0x0b, 0x44, 0x6f, 0x63, 0x41, 0x63, 0x74, 0x69, 0x76, 0x69, 0x74,
+	0x79, 0x12, 0x16, 0x2e, 0x73, 0x74, 0x64, 0x6c, 0x69, 0x62, 0x2e, 0x44, 0x6f, 0x63, 0x41, 0x63,
+	0x74, 0x69, 0x76, 0x69, 0x74, 0x79, 0x52, 0x65, 0x71, 0x1a, 0x17, 0x2e, 0x73, 0x74, 0x64, 0x6c,
+	0x69, 0x62, 0x2e, 0x44, 0x6f, 0x63, 0x41, 0x63, 0x74, 0x69, 0x76, 0x69, 0x74, 0x79, 0x52, 0x65,
+	0x73, 0x70, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
 }
 }
 
 
 var (
 var (

+ 7 - 7
rpc/stdlib/stdlibclient/stdlib.go

@@ -14,18 +14,18 @@ import (
 )
 )
 
 
 type (
 type (
-	DocActivityReq    = stdlib.DocActivityReq
 	DocActivity       = stdlib.DocActivity
 	DocActivity       = stdlib.DocActivity
-	Doc               = stdlib.Doc
-	DocGetCheckResp   = stdlib.DocGetCheckResp
-	DocGetContentResp = stdlib.DocGetContentResp
+	DocQueryRequest   = stdlib.DocQueryRequest
+	DocQueryResponse  = stdlib.DocQueryResponse
+	DocChangeReq      = stdlib.DocChangeReq
 	DocChangeResp     = stdlib.DocChangeResp
 	DocChangeResp     = stdlib.DocChangeResp
 	DocStatisticsReq  = stdlib.DocStatisticsReq
 	DocStatisticsReq  = stdlib.DocStatisticsReq
 	DocGetCheckReq    = stdlib.DocGetCheckReq
 	DocGetCheckReq    = stdlib.DocGetCheckReq
+	DocGetCheckResp   = stdlib.DocGetCheckResp
+	Doc               = stdlib.Doc
+	DocGetContentResp = stdlib.DocGetContentResp
+	DocActivityReq    = stdlib.DocActivityReq
 	DocActivityResp   = stdlib.DocActivityResp
 	DocActivityResp   = stdlib.DocActivityResp
-	DocQueryRequest   = stdlib.DocQueryRequest
-	DocQueryResponse  = stdlib.DocQueryResponse
-	DocChangeReq      = stdlib.DocChangeReq
 
 
 	Stdlib interface {
 	Stdlib interface {
 		DocQuery(ctx context.Context, in *DocQueryRequest) (*DocQueryResponse, error)
 		DocQuery(ctx context.Context, in *DocQueryRequest) (*DocQueryResponse, error)

+ 5 - 2
rpc/stdlib/test/docquery_test.go

@@ -15,10 +15,13 @@ import (
 func Test_Docquery(t *testing.T) {
 func Test_Docquery(t *testing.T) {
 	ctx, _ := context.WithTimeout(context.Background(), 10*time.Second)
 	ctx, _ := context.WithTimeout(context.Background(), 10*time.Second)
 	std := stdlibclient.NewStdlib(zrpc.MustNewClient(zrpc.RpcClientConf{Etcd: discov.EtcdConf{Hosts: []string{"127.0.0.1:2379"}, Key: "jydocs.stdlib.rpc"}}))
 	std := stdlibclient.NewStdlib(zrpc.MustNewClient(zrpc.RpcClientConf{Etcd: discov.EtcdConf{Hosts: []string{"127.0.0.1:2379"}, Key: "jydocs.stdlib.rpc"}}))
-	res, err := std.DocQuery(ctx, &stdlib.DocQueryRequest{KeyWord: "软件", PageSize: 3})
+	res, err := std.DocQuery(ctx, &stdlib.DocQueryRequest{UserId: "5d6378301c298a5aac7b5402", AppId: "jy", KeyWord: "软件", PageSize: 3, Sort: []string{}})
 	if err != nil {
 	if err != nil {
 		log.Println(err)
 		log.Println(err)
 	} else {
 	} else {
-		log.Println(res.Docs[0])
+		log.Println(res.Total, res.Code, res.Msg)
+		for _, v := range res.Docs {
+			log.Println(v)
+		}
 	}
 	}
 }
 }

+ 8 - 1
services/model/base_model.go

@@ -1,8 +1,9 @@
 package model
 package model
 
 
 import (
 import (
-	"gorm.io/gorm"
 	"time"
 	"time"
+
+	"gorm.io/gorm"
 )
 )
 
 
 type BaseModel struct {
 type BaseModel struct {
@@ -19,4 +20,10 @@ const (
 	UserDocCategory_SelfUpload      = 0 //自己上传
 	UserDocCategory_SelfUpload      = 0 //自己上传
 	UserDocCategory_Download        = 1 //转存(下载)
 	UserDocCategory_Download        = 1 //转存(下载)
 	UserDocCategory_Collect         = 2 //收藏
 	UserDocCategory_Collect         = 2 //收藏
+	//es
+	Es_JyDoc = "jydoc" //es中文库的别名
+)
+
+var (
+	DocFileType = map[int]string{1: "doc", 2: "pdf", 3: "xls", 4: "ppt", 5: "txt", 6: "其他"}
 )
 )

+ 6 - 5
services/stdlib/docChangeService.go

@@ -1,13 +1,14 @@
 package stdlib
 package stdlib
 
 
 import (
 import (
+	"errors"
+	"log"
+	"time"
+
 	"app.yhyue.com/moapp/jy_docs/services/model"
 	"app.yhyue.com/moapp/jy_docs/services/model"
 	jyDocsRpcUtil "app.yhyue.com/moapp/jy_docs/services/util"
 	jyDocsRpcUtil "app.yhyue.com/moapp/jy_docs/services/util"
 	elastic "app.yhyue.com/moapp/jybase/esv7"
 	elastic "app.yhyue.com/moapp/jybase/esv7"
-	"errors"
 	"gorm.io/gorm"
 	"gorm.io/gorm"
-	"log"
-	"time"
 )
 )
 
 
 const DocOn = 1
 const DocOn = 1
@@ -69,7 +70,7 @@ func ChangeDocumentOn(doc *model.Doc, reason int32) bool {
 			"docPageSize": docData["docPageSize"],
 			"docPageSize": docData["docPageSize"],
 			"docFileType": docData["docFileType"],
 			"docFileType": docData["docFileType"],
 		}
 		}
-		if rs := elastic.Save(jyDocsRpcUtil.Es_JyDoc, "_doc", saveData); rs != true {
+		if rs := elastic.Save(model.Es_JyDoc, "_doc", saveData); rs != true {
 			return errors.New("发布到检索库失败")
 			return errors.New("发布到检索库失败")
 		}
 		}
 		return nil
 		return nil
@@ -108,7 +109,7 @@ func ChangeDocumentOff(doc *model.Doc, reason int32) bool {
 			return err
 			return err
 		}
 		}
 
 
-		if rs := elastic.DelById(jyDocsRpcUtil.Es_JyDoc, "doc", doc.Id); rs != true {
+		if rs := elastic.DelById(model.Es_JyDoc, "doc", doc.Id); rs != true {
 			return errors.New("从检索库删除失败")
 			return errors.New("从检索库删除失败")
 		}
 		}
 		return nil
 		return nil

+ 86 - 40
services/stdlib/docService.go

@@ -6,18 +6,23 @@ import (
 	"regexp"
 	"regexp"
 	"strings"
 	"strings"
 
 
+	"app.yhyue.com/moapp/jy_docs/rpc/stdlib/stdlib"
+	"app.yhyue.com/moapp/jy_docs/services/model"
 	jyDocsRpcUtil "app.yhyue.com/moapp/jy_docs/services/util"
 	jyDocsRpcUtil "app.yhyue.com/moapp/jy_docs/services/util"
 	"app.yhyue.com/moapp/jybase/common"
 	"app.yhyue.com/moapp/jybase/common"
 	elastic "app.yhyue.com/moapp/jybase/esv7"
 	elastic "app.yhyue.com/moapp/jybase/esv7"
 )
 )
 
 
 const (
 const (
+	Es_Query_All       = `{"query":{"match_all":{}}%s}`
 	Es_Query_Boosting  = `{"query":{"boosting":{"positive":{"bool":{"must":[%s]}},"negative":{"bool":{"must":[%s]}},"negative_boost":2}}%s}`
 	Es_Query_Boosting  = `{"query":{"boosting":{"positive":{"bool":{"must":[%s]}},"negative":{"bool":{"must":[%s]}},"negative_boost":2}}%s}`
 	Es_Query_Bool      = `{"query":{"bool":{"filter":[%s]}}%s}`
 	Es_Query_Bool      = `{"query":{"bool":{"filter":[%s]}}%s}`
-	Es_Query_Append    = `,"_source":["id","docName","price","downTimes","viewTimes","docSummary","uploadDate","docFileSize","docPageSize","docFileType"],"sort":{%s},"from":%d,"size":%d,"highlight":{"fields":{"docName":{},"docSummary":{}}}`
-	Multi_Match        = `{"multi_match":{"query":"%s","fields":["docName","docSummary"]}}`
+	Es_Query_Append    = `,"_source":["id","docName","price","downTimes","viewTimes","docSummary","uploadDate","docFileSize","docPageSize","docFileType"],"from":%d,"size":%d`
+	Es_Query_Highlight = `,"highlight":{"fields":{"docName":{},"docSummary":{"fragment_size":100,"number_of_fragments":1}}}`
+	Es_Query_Sort      = `,"sort":{%s}`
+	Multi_Match        = `{"multi_match":{"query":"%s","fields":["docName","docSummary^2"]}}`
 	Multi_Match_Phrase = `{"multi_match":{"query":"%s","fields":["docName.docName_c","docSummary.docSummary_c"],"type":"phrase"}}`
 	Multi_Match_Phrase = `{"multi_match":{"query":"%s","fields":["docName.docName_c","docSummary.docSummary_c"],"type":"phrase"}}`
-	Terms              = `{"trems":{"%s":[%s]}}`
+	Terms              = `{"terms":{"%s":[%s]}}`
 )
 )
 
 
 var (
 var (
@@ -28,55 +33,96 @@ func FindDocumentById(id int) {
 	log.Println(jyDocsRpcUtil.GetJyDocsDB().Exec("select * from ").Error)
 	log.Println(jyDocsRpcUtil.GetJyDocsDB().Exec("select * from ").Error)
 }
 }
 
 
-func FindDocumentsByKeyWords(keyWord string, docClass, docTag []string, publishTimeSort, downloadSort, viewSort, pageNum, pageSize int64) (int64, *[]map[string]interface{}) {
+func DocQuery(in *stdlib.DocQueryRequest) *stdlib.DocQueryResponse {
 	defer common.Catch()
 	defer common.Catch()
-	keyWord = strings.TrimSpace(keyWord)
+	in.KeyWord = strings.TrimSpace(in.KeyWord)
 	musts := []string{}
 	musts := []string{}
 	negative_musts := []string{}
 	negative_musts := []string{}
-	sorts := []string{`"_score":"desc"`}
-	//上架时间
-	if publishTimeSort > 0 {
-		sorts = append(sorts, `"create_at":"asc"`)
-	} else if viewSort < 0 {
-		sorts = append(sorts, `"create_at":"desc"`)
-	}
-	//下载量
-	if downloadSort > 0 {
-		sorts = append(sorts, `"downTimes":"asc"`)
-	} else if viewSort < 0 {
-		sorts = append(sorts, `"downTimes":"desc"`)
-	}
-	//浏览量
-	if viewSort > 0 {
-		sorts = append(sorts, `"viewTimes":"asc"`)
-	} else if viewSort < 0 {
-		sorts = append(sorts, `"viewTimes":"desc"`)
-	}
-	//分类
-	if len(docClass) > 0 {
-		musts = append(musts, fmt.Sprintf(Terms, "docClassLevelOne", strings.Join(docClass, ",")))
-	}
-	//标签
-	if len(docTag) > 0 {
-		musts = append(musts, fmt.Sprintf(Terms, "docTags", strings.Join(docTag, ",")))
-	}
+	sorts := []string{}
 	//搜索词
 	//搜索词
-	if keyWord != "" {
-		for _, v := range strings.Split(keyWord, " ") {
+	if in.KeyWord != "" {
+		sorts = append(sorts, `"_score":"desc"`)
+		for _, v := range strings.Split(in.KeyWord, " ") {
 			v = strings.ReplaceAll(v, `"`, `\"`)
 			v = strings.ReplaceAll(v, `"`, `\"`)
 			musts = append(musts, fmt.Sprintf(Multi_Match, v))
 			musts = append(musts, fmt.Sprintf(Multi_Match, v))
 			negative_musts = append(negative_musts, fmt.Sprintf(Multi_Match_Phrase, v))
 			negative_musts = append(negative_musts, fmt.Sprintf(Multi_Match_Phrase, v))
 		}
 		}
 	}
 	}
-	if len(musts) == 0 {
-		return 0, nil
+	for _, v := range in.Sort {
+		if strings.HasPrefix(v, "-") {
+			sorts = append(sorts, fmt.Sprintf(`"%s":"desc"`, strings.TrimLeft(v, "-")))
+		} else {
+			sorts = append(sorts, fmt.Sprintf(`"%s":"asc"`, v))
+		}
+	}
+	//分类
+	if len(in.DocClass) > 0 {
+		musts = append(musts, fmt.Sprintf(Terms, "docClass", `"`+strings.Join(in.DocClass, `","`)+`"`))
+	}
+	//标签
+	if len(in.DocTag) > 0 {
+		musts = append(musts, fmt.Sprintf(Terms, "docTags", `"`+strings.Join(in.DocTag, `","`)+`"`))
 	}
 	}
 	query := ""
 	query := ""
-	if keyWord != "" {
-		query = fmt.Sprintf(Es_Query_Boosting, strings.Join(musts, ","), strings.Join(negative_musts, ","), fmt.Sprintf(Es_Query_Append, strings.Join(sorts, ","), (pageNum-1)*pageSize, pageSize))
+	query_sort := ""
+	if len(sorts) > 0 {
+		query_sort = fmt.Sprintf(Es_Query_Sort, strings.Join(sorts, ","))
+	}
+	query_append := fmt.Sprintf(Es_Query_Append, (in.PageNum-1)*in.PageSize, in.PageSize)
+	if len(musts) == 0 {
+		query = fmt.Sprintf(Es_Query_All, fmt.Sprint(query_append, query_sort))
+	} else if in.KeyWord != "" {
+		query = fmt.Sprintf(Es_Query_Boosting, strings.Join(musts, ","), strings.Join(negative_musts, ","), fmt.Sprint(query_append, query_sort, Es_Query_Highlight))
 	} else {
 	} else {
-		query = fmt.Sprintf(Es_Query_Bool, strings.Join(musts, ","), fmt.Sprintf(Es_Query_Append, strings.Join(sorts, ","), (pageNum-1)*pageSize, pageSize))
+		query = fmt.Sprintf(Es_Query_Bool, strings.Join(musts, ","), fmt.Sprint(query_append, query_sort))
 	}
 	}
 	log.Println("query:", query)
 	log.Println("query:", query)
-	return elastic.DfsGet(jyDocsRpcUtil.Es_JyDoc, "", query)
+	total, list := elastic.GetBySearchType(model.Es_JyDoc, "dfs_query_then_fetch", query)
+	docs := []*stdlib.Doc{}
+	//获取我购买的文档
+	if list != nil {
+		myDocs := map[string]int64{}
+		if in.UserId != "" {
+			docIds, whs := []interface{}{}, []string{}
+			for _, v := range *list {
+				whs = append(whs, "?")
+				docIds = append(docIds, common.ObjToString(v["id"]))
+			}
+			args := []interface{}{in.UserId, model.UserDocStatus_Normal, in.AppId}
+			args = append(args, docIds...)
+			userDocs := []*model.UserDoc{}
+			jyDocsRpcUtil.GetJyDocsDB().Exec(`select docId from user_doc where userId=? and isDelete=? and appId=? and isDownload=1 and docId in (`+strings.Join(whs, ",")+`)`, args...).Find(&userDocs)
+			for _, v := range userDocs {
+				myDocs[v.DocId] = 1
+			}
+		}
+		for _, v := range *list {
+			doc := &stdlib.Doc{
+				DocId:       common.ObjToString(v["id"]),
+				DocName:     common.ObjToString(v["docName"]),
+				Price:       common.Int64All(v["price"]),
+				DocPageSize: common.Int64All(v["docPageSize"]),
+				DocFileSize: common.Int64All(v["docFileSize"]),
+				DownTimes:   common.Int64All(v["downTimes"]),
+				ViewTimes:   common.Int64All(v["viewTimes"]),
+				UploadDate:  common.ObjToString(v["uploadDate"]),
+				DocSummary:  common.ObjToString(v["docSummary"]),
+				DocFileType: model.DocFileType[common.IntAll(v["docFileType"])],
+			}
+			highlight, _ := v["highlight"].(map[string][]string)
+			if len(highlight["docName"]) > 0 {
+				doc.DocName = highlight["docName"][0]
+			}
+			if len(highlight["docSummary"]) > 0 {
+				doc.DocSummary = highlight["docSummary"][0]
+			}
+			doc.IsDownload = myDocs[doc.DocId]
+			docs = append(docs, doc)
+		}
+	}
+	return &stdlib.DocQueryResponse{
+		Total: total,
+		Docs:  docs,
+		Code:  1,
+	}
 }
 }

+ 0 - 16
services/util/util.go

@@ -1,16 +0,0 @@
-package util
-
-const (
-	Es_JyDoc = "jydoc" //es中文库的别名
-)
-
-var (
-	DocFileType = map[int]string{
-		1: "doc",
-		2: "pdf",
-		3: "xls",
-		4: "ppt",
-		5: "txt",
-		6: "其他",
-	}
-)