李哲 4 tahun lalu
induk
melakukan
49c4460fa6

+ 3 - 2
go.mod

@@ -4,13 +4,14 @@ go 1.14
 
 require (
 	app.yhyue.com/moapp/jyPoints v0.0.0-20210316030700-afaec87a982b
-	app.yhyue.com/moapp/jybase v0.0.0-20210312055531-9bf805cce8ab
+	app.yhyue.com/moapp/jybase v0.0.0-20210316070116-ec6a9a875194
 	app.yhyue.com/moapp/jyfs v0.0.0-20210309070327-ecad67beabb8
 	github.com/golang/protobuf v1.4.3
+	github.com/mailru/easyjson v0.7.7 // indirect
 	github.com/tal-tech/go-zero v1.1.5
 	google.golang.org/grpc v1.29.1
 	google.golang.org/protobuf v1.25.0
-	gorm.io/gorm v1.20.8
+	gorm.io/gorm v1.21.3
 )
 
 replace google.golang.org/grpc => google.golang.org/grpc v1.29.1

+ 15 - 10
go.sum

@@ -1,7 +1,7 @@
 app.yhyue.com/moapp/jyPoints v0.0.0-20210316030700-afaec87a982b h1:5HuXJ4k+0WwyJgkakUx8swhxz16xBJjH6FNogkupURY=
 app.yhyue.com/moapp/jyPoints v0.0.0-20210316030700-afaec87a982b/go.mod h1:nz39UQcXwZV90vOC7rIfos4LgrjGDcywHo96rdywdzk=
-app.yhyue.com/moapp/jybase v0.0.0-20210312055531-9bf805cce8ab h1:e0w9yaAu+xiwtSebZDYa0kog3QptpLK+4iKxRhq9vyE=
-app.yhyue.com/moapp/jybase v0.0.0-20210312055531-9bf805cce8ab/go.mod h1:K2jMm63fzsEtUjGwtww36U2+0ZFUiZu3AdVm2KZvbUI=
+app.yhyue.com/moapp/jybase v0.0.0-20210316070116-ec6a9a875194 h1:86uHUxF4pgzU1KBE2MB85HC46Nz7l1raArCb9xiIxKQ=
+app.yhyue.com/moapp/jybase v0.0.0-20210316070116-ec6a9a875194/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/go.mod h1:iflE6z/Ee5f7YZy2DSj7S6asyL1yCbu3BjK/xMYMiDY=
 cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
@@ -50,12 +50,15 @@ github.com/coreos/go-semver v0.2.0 h1:3Jm3tLmsgAYcjC+4Up7hJrFBPr+n7rAqYeSw/SZazu
 github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk=
 github.com/coreos/go-systemd/v22 v22.0.0 h1:XJIw/+VlJ+87J+doOxznsAWIdmWuViOVhkQamW5YV28=
 github.com/coreos/go-systemd/v22 v22.0.0/go.mod h1:xO0FLkIi5MaZafQlIrOotqXZ90ih+1atmu1JpKERPPk=
+github.com/coscms/tagfast v0.0.0-20150925144250-2b69b2496250/go.mod h1:zX8vynptAghuV/KG8BOZlDeo4DsTKWfBQ154RWlkay0=
 github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
 github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
 github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY=
 github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
 github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
 github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
+github.com/dchest/captcha v0.0.0-20200903113550-03f5f0333e1f h1:q/DpyjJjZs94bziQ7YkBmIlpqbVP7yw179rnzoNVX1M=
+github.com/dchest/captcha v0.0.0-20200903113550-03f5f0333e1f/go.mod h1:QGrK8vMWWHQYQ3QU9bw9Y9OPNfxccGzfb41qjvVeXtY=
 github.com/dchest/siphash v1.2.1/go.mod h1:q+IRvb2gOSrUnYoPqHiyHXS0FOBBOdl6tONBlVnOnt4=
 github.com/denisenkom/go-mssqldb v0.0.0-20190707035753-2be1aa521ff4/go.mod h1:zAg7JM8CkOJ43xKXIj7eRO9kmWm/TW578qo+oDO6tuM=
 github.com/dgrijalva/jwt-go v3.2.0+incompatible h1:7qlOGliEKZXTDg6OTjfoBKDXWrumCAMpl/TFQ4/5kLM=
@@ -158,6 +161,7 @@ github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5a
 github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
 github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
 github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
+github.com/google/go-cmp v0.5.0 h1:/QaMHBdZ26BB3SSst0Iwl10Epc+xhTquomWX0oZEB6w=
 github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
 github.com/google/go-cmp v0.5.2 h1:X2ev0eStA3AbceY54o37/0PQ/UWqKEiiO2dKL5OPaFM=
 github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
@@ -185,6 +189,7 @@ github.com/grpc-ecosystem/grpc-gateway v1.14.3/go.mod h1:6CwZWGDSPRJidgKAtJVvND6
 github.com/h2non/parth v0.0.0-20190131123155-b4df798d6542 h1:2VTzZjLZBgl62/EtslCrtky5vbi9dd7HrQPQIx6wqiw=
 github.com/h2non/parth v0.0.0-20190131123155-b4df798d6542/go.mod h1:Ow0tF8D4Kplbc8s8sSb3V2oUCygFHVp8gC3Dn6U4MNI=
 github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
+github.com/howeyc/fsnotify v0.9.0/go.mod h1:41HzSPxBGeFRQKEEwgh49TRw/nKBsYZ2cF1OzPjSJsA=
 github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI=
 github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
 github.com/iancoleman/strcase v0.1.2/go.mod h1:SK73tn/9oHe+/Y0h39VT4UCxmurVJkR5NA7kMEAOgSE=
@@ -264,8 +269,6 @@ github.com/nbio/st v0.0.0-20140626010706-e9e8d9816f32 h1:W6apQkHrMkS0Muv8G/TipAy
 github.com/nbio/st v0.0.0-20140626010706-e9e8d9816f32/go.mod h1:9wM+0iRr9ahx58uYLpLIr5fm8diHn0JbqRycJi6w0Ms=
 github.com/olekukonko/tablewriter v0.0.0-20170122224234-a0225b3f23b5/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo=
 github.com/olekukonko/tablewriter v0.0.4/go.mod h1:zq6QwlOf5SlnkVbMSr5EoBv3636FWnp+qbPhuoO21uA=
-github.com/olivere/elastic v6.2.35+incompatible h1:MMklYDy2ySi01s123CB2WLBuDMzFX4qhFcA5tKWJPgM=
-github.com/olivere/elastic v6.2.35+incompatible/go.mod h1:J+q1zQJTgAz9woqsbVRqGeB5G1iqDKVBWLNSYW8yfJ8=
 github.com/olivere/elastic/v7 v7.0.22 h1:esBA6JJwvYgfms0EVlH7Z+9J4oQ/WUADF2y/nCNDw7s=
 github.com/olivere/elastic/v7 v7.0.22/go.mod h1:VDexNy9NjmtAkrjNoI7tImv7FR4tf5zUA3ickqu5Pc8=
 github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
@@ -331,6 +334,7 @@ github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4k
 github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI=
 github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA=
 github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ=
+github.com/spf13/pflag v1.0.1 h1:aCvUg6QPl3ibpQUxyLkrEkCHtPqYJL4x9AuhqVqFis4=
 github.com/spf13/pflag v1.0.1/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
 github.com/spf13/pflag v1.0.3 h1:zPAT6CGy6wXeQ7NtTnaTerfKOsV6V6F8agHXFiazDkg=
 github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
@@ -339,6 +343,7 @@ github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+
 github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
 github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
 github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
+github.com/stretchr/testify v1.5.1 h1:nOGnQDM7FYENwehXlg/kFVnos3rEvtKTjRvOWSzb6H4=
 github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
 github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0=
 github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
@@ -511,6 +516,7 @@ google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGj
 google.golang.org/protobuf v1.25.0 h1:Ejskq+SyPohKW+1uil0JJMtmHCgJPJ/qWTxr8qp+R4c=
 google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c=
 gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
+gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc/go.mod h1:m7x9LTH6d71AHyAX77c9yqWCCa3UKHcVEj9y7hAtKDk=
 gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
 gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
 gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo=
@@ -520,9 +526,9 @@ gopkg.in/cheggaaa/pb.v1 v1.0.28/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qS
 gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
 gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4=
 gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
+gopkg.in/gomail.v2 v2.0.0-20160411212932-81ebce5c23df/go.mod h1:LRQQ+SO6ZHR7tOkpBDuZnXENFzX8qRjMDMyPD6BRkCw=
 gopkg.in/h2non/gock.v1 v1.0.15 h1:SzLqcIlb/fDfg7UvukMpNcWsu7sI5tWwL+KCATZqks0=
 gopkg.in/h2non/gock.v1 v1.0.15/go.mod h1:sX4zAkdYX1TRGJ2JY156cFspQn4yRWn6p9EMdODlynE=
-gopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22/go.mod h1:yeKp02qBN3iKW1OzL3MGk2IdtZzaj7SFntXj72NppTA=
 gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo=
 gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ=
 gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
@@ -537,11 +543,10 @@ gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
 gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
 gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
 gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
-gorm.io/driver/mysql v1.0.3 h1:+JKBYPfn1tygR1/of/Fh2T8iwuVwzt+PEJmKaXzMQXg=
-gorm.io/driver/mysql v1.0.3/go.mod h1:twGxftLBlFgNVNakL7F+P/x9oYqoymG3YYT8cAfI9oI=
-gorm.io/gorm v1.20.4/go.mod h1:0HFTzE/SqkGTzK6TlDPPQbAYCluiVvhzoA1+aVyzenw=
-gorm.io/gorm v1.20.8 h1:iToaOdZgjNvlc44NFkxfLa3U9q63qwaxt0FdNCiwOMs=
-gorm.io/gorm v1.20.8/go.mod h1:0HFTzE/SqkGTzK6TlDPPQbAYCluiVvhzoA1+aVyzenw=
+gorm.io/driver/mysql v1.0.5 h1:WAAmvLK2rG0tCOqrf5XcLi2QUwugd4rcVJ/W3aoon9o=
+gorm.io/driver/mysql v1.0.5/go.mod h1:N1OIhHAIhx5SunkMGqWbGFVeh4yTNWKmMo1GOAsohLI=
+gorm.io/gorm v1.21.3 h1:qDFi55ZOsjZTwk5eN+uhAmHi8GysJ/qCTichM/yO7ME=
+gorm.io/gorm v1.21.3/go.mod h1:0HFTzE/SqkGTzK6TlDPPQbAYCluiVvhzoA1+aVyzenw=
 honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
 honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
 honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=

+ 22 - 10
rpc/stdlib/internal/logic/docquerylogic.go

@@ -5,8 +5,8 @@ import (
 
 	"app.yhyue.com/moapp/jy_docs/rpc/stdlib/internal/svc"
 	"app.yhyue.com/moapp/jy_docs/rpc/stdlib/stdlib"
-
 	stdlibService "app.yhyue.com/moapp/jy_docs/services/stdlib"
+	"app.yhyue.com/moapp/jybase/common"
 	"github.com/tal-tech/go-zero/core/logx"
 )
 
@@ -25,15 +25,27 @@ func NewDocQueryLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DocQuery
 }
 
 func (l *DocQueryLogic) DocQuery(in *stdlib.DocQueryRequest) (*stdlib.DocQueryResponse, error) {
-	// todo: add your logic here and delete this line
-	//调用service示例
-	stdlibService.FindDocumentById(1)
-	//end of service call demo
-
-	pageNum := 0
 	if in.PageNum <= 0 {
-		pageNum = 0
+		in.PageNum = 0
+	}
+	total, list := stdlibService.FindDocumentsByKeyWords(in.KeyWord, in.ClassLevelOne, in.ClassLevelTwo, in.Tag, 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"]),
+				UploadDate:  common.ObjToString(v["uploadDate"]),
+				DocSummary:  common.ObjToString(v["docSummary"]),
+			})
+		}
 	}
-	stdlibService.FindDocumentsByKeyWords(in.KeyWords, pageNum)
-	return &stdlib.DocQueryResponse{}, nil
+	return &stdlib.DocQueryResponse{
+		Total: total,
+		Docs:  docs,
+	}, nil
 }

+ 16 - 15
rpc/stdlib/stdlib.proto

@@ -3,31 +3,32 @@ syntax = "proto3";
 package stdlib;
 
 message DocQueryRequest {
-  int32 pageNum = 1; //页码 
-  int32 pageSize = 2; //每页数量
-  string keyWords = 3; //检索词  文档名检索  模糊
-  repeated string itemArr = 4;  // 分类 []string
-  repeated string tagArr = 5;  // 标签 []string
-  int32 publishTimeSort = 6;  // 发布时间排序 1正序 -1倒序
-  int32 downloadSort = 7;		// 下载次数排序 1正序 -1倒序
-  int32	viewSort = 8;			// 浏览量排序 1正序 -1倒序
+  int64 pageNum = 1; //页码 
+  int64 pageSize = 2; //每页数量
+  string keyWord = 3; //检索词  文档名检索  模糊
+  repeated string classLevelOne = 4;  // 一级分类 []string
+  repeated string classLevelTwo = 5;  // 二级分类 []string
+  repeated string tag = 6;  // 标签 []string
+  int64 updateDateSort = 7;  // 上传时间排序 1正序 -1倒序
+  int64 downloadSort = 8;		// 下载次数排序 1正序 -1倒序
+  int64	viewSort = 9;			// 浏览量排序 1正序 -1倒序
 }
 
 message DocQueryResponse {
-  int32 code = 1;    //响应代码
+  int64 code = 1;    //响应代码
   string msg = 2; //响应消息
   repeated Doc docs = 3;//文档列表集合,没有分页参数
-  int32 total = 4; //总数
+  int64 total = 4; //总数
 }
 
 message Doc {
   string docId = 1;//文档id
   string docName = 2;//文档名称
-  int32 docType = 3;//文档类型
-  int32 docFileSize = 4;//文档大小
-  int32 docPageSize = 5;//文档页码数
-  string tags = 6;//文档标签
-  string userId = 7;//上传人id
+  int64 price = 3;//价格
+  int64 docFileSize = 4;//文档大小
+  int64 docPageSize = 5;//文档页码数
+  int64 downTimes = 6;//下载次数
+  string uploadDate = 7;//上传时间
   string docSummary = 8; //摘要
 }
 

+ 174 - 162
rpc/stdlib/stdlib/stdlib.pb.go

@@ -1,7 +1,7 @@
 // Code generated by protoc-gen-go. DO NOT EDIT.
 // versions:
 // 	protoc-gen-go v1.25.0
-// 	protoc        v3.15.5
+// 	protoc        v3.15.6
 // source: stdlib.proto
 
 package stdlib
@@ -34,14 +34,15 @@ type DocQueryRequest struct {
 	sizeCache     protoimpl.SizeCache
 	unknownFields protoimpl.UnknownFields
 
-	PageNum         int32    `protobuf:"varint,1,opt,name=pageNum,proto3" json:"pageNum,omitempty"`                 //页码
-	PageSize        int32    `protobuf:"varint,2,opt,name=pageSize,proto3" json:"pageSize,omitempty"`               //每页数量
-	KeyWords        string   `protobuf:"bytes,3,opt,name=keyWords,proto3" json:"keyWords,omitempty"`                //检索词  文档名检索  模糊
-	ItemArr         []string `protobuf:"bytes,4,rep,name=itemArr,proto3" json:"itemArr,omitempty"`                  // 分类 []string
-	TagArr          []string `protobuf:"bytes,5,rep,name=tagArr,proto3" json:"tagArr,omitempty"`                    // 标签 []string
-	PublishTimeSort int32    `protobuf:"varint,6,opt,name=publishTimeSort,proto3" json:"publishTimeSort,omitempty"` // 发布时间排序 1正序 -1倒序
-	DownloadSort    int32    `protobuf:"varint,7,opt,name=downloadSort,proto3" json:"downloadSort,omitempty"`       // 下载次数排序 1正序 -1倒序
-	ViewSort        int32    `protobuf:"varint,8,opt,name=viewSort,proto3" json:"viewSort,omitempty"`               // 浏览量排序 1正序 -1倒序
+	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"`                //检索词  文档名检索  模糊
+	ClassLevelOne  []string `protobuf:"bytes,4,rep,name=classLevelOne,proto3" json:"classLevelOne,omitempty"`    // 一级分类 []string
+	ClassLevelTwo  []string `protobuf:"bytes,5,rep,name=classLevelTwo,proto3" json:"classLevelTwo,omitempty"`    // 二级分类 []string
+	Tag            []string `protobuf:"bytes,6,rep,name=tag,proto3" json:"tag,omitempty"`                        // 标签 []string
+	UpdateDateSort int64    `protobuf:"varint,7,opt,name=updateDateSort,proto3" json:"updateDateSort,omitempty"` // 上传时间排序 1正序 -1倒序
+	DownloadSort   int64    `protobuf:"varint,8,opt,name=downloadSort,proto3" json:"downloadSort,omitempty"`     // 下载次数排序 1正序 -1倒序
+	ViewSort       int64    `protobuf:"varint,9,opt,name=viewSort,proto3" json:"viewSort,omitempty"`             // 浏览量排序 1正序 -1倒序
 }
 
 func (x *DocQueryRequest) Reset() {
@@ -76,56 +77,63 @@ func (*DocQueryRequest) Descriptor() ([]byte, []int) {
 	return file_stdlib_proto_rawDescGZIP(), []int{0}
 }
 
-func (x *DocQueryRequest) GetPageNum() int32 {
+func (x *DocQueryRequest) GetPageNum() int64 {
 	if x != nil {
 		return x.PageNum
 	}
 	return 0
 }
 
-func (x *DocQueryRequest) GetPageSize() int32 {
+func (x *DocQueryRequest) GetPageSize() int64 {
 	if x != nil {
 		return x.PageSize
 	}
 	return 0
 }
 
-func (x *DocQueryRequest) GetKeyWords() string {
+func (x *DocQueryRequest) GetKeyWord() string {
 	if x != nil {
-		return x.KeyWords
+		return x.KeyWord
 	}
 	return ""
 }
 
-func (x *DocQueryRequest) GetItemArr() []string {
+func (x *DocQueryRequest) GetClassLevelOne() []string {
 	if x != nil {
-		return x.ItemArr
+		return x.ClassLevelOne
 	}
 	return nil
 }
 
-func (x *DocQueryRequest) GetTagArr() []string {
+func (x *DocQueryRequest) GetClassLevelTwo() []string {
 	if x != nil {
-		return x.TagArr
+		return x.ClassLevelTwo
 	}
 	return nil
 }
 
-func (x *DocQueryRequest) GetPublishTimeSort() int32 {
+func (x *DocQueryRequest) GetTag() []string {
 	if x != nil {
-		return x.PublishTimeSort
+		return x.Tag
+	}
+	return nil
+}
+
+func (x *DocQueryRequest) GetUpdateDateSort() int64 {
+	if x != nil {
+		return x.UpdateDateSort
 	}
 	return 0
 }
 
-func (x *DocQueryRequest) GetDownloadSort() int32 {
+func (x *DocQueryRequest) GetDownloadSort() int64 {
 	if x != nil {
 		return x.DownloadSort
 	}
 	return 0
 }
 
-func (x *DocQueryRequest) GetViewSort() int32 {
+func (x *DocQueryRequest) GetViewSort() int64 {
 	if x != nil {
 		return x.ViewSort
 	}
@@ -137,10 +145,10 @@ type DocQueryResponse struct {
 	sizeCache     protoimpl.SizeCache
 	unknownFields protoimpl.UnknownFields
 
-	Code  int32  `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty"`   //响应代码
+	Code  int64  `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty"`   //响应代码
 	Msg   string `protobuf:"bytes,2,opt,name=msg,proto3" json:"msg,omitempty"`      //响应消息
 	Docs  []*Doc `protobuf:"bytes,3,rep,name=docs,proto3" json:"docs,omitempty"`    //文档列表集合,没有分页参数
-	Total int32  `protobuf:"varint,4,opt,name=total,proto3" json:"total,omitempty"` //总数
+	Total int64  `protobuf:"varint,4,opt,name=total,proto3" json:"total,omitempty"` //总数
 }
 
 func (x *DocQueryResponse) Reset() {
@@ -175,7 +183,7 @@ func (*DocQueryResponse) Descriptor() ([]byte, []int) {
 	return file_stdlib_proto_rawDescGZIP(), []int{1}
 }
 
-func (x *DocQueryResponse) GetCode() int32 {
+func (x *DocQueryResponse) GetCode() int64 {
 	if x != nil {
 		return x.Code
 	}
@@ -196,7 +204,7 @@ func (x *DocQueryResponse) GetDocs() []*Doc {
 	return nil
 }
 
-func (x *DocQueryResponse) GetTotal() int32 {
+func (x *DocQueryResponse) GetTotal() int64 {
 	if x != nil {
 		return x.Total
 	}
@@ -210,11 +218,11 @@ type Doc struct {
 
 	DocId       string `protobuf:"bytes,1,opt,name=docId,proto3" json:"docId,omitempty"`              //文档id
 	DocName     string `protobuf:"bytes,2,opt,name=docName,proto3" json:"docName,omitempty"`          //文档名称
-	DocType     int32  `protobuf:"varint,3,opt,name=docType,proto3" json:"docType,omitempty"`         //文档类型
-	DocFileSize int32  `protobuf:"varint,4,opt,name=docFileSize,proto3" json:"docFileSize,omitempty"` //文档大小
-	DocPageSize int32  `protobuf:"varint,5,opt,name=docPageSize,proto3" json:"docPageSize,omitempty"` //文档页码数
-	Tags        string `protobuf:"bytes,6,opt,name=tags,proto3" json:"tags,omitempty"`                //文档标签
-	UserId      string `protobuf:"bytes,7,opt,name=userId,proto3" json:"userId,omitempty"`            //上传人id
+	Price       int64  `protobuf:"varint,3,opt,name=price,proto3" json:"price,omitempty"`             //价格
+	DocFileSize int64  `protobuf:"varint,4,opt,name=docFileSize,proto3" json:"docFileSize,omitempty"` //文档大小
+	DocPageSize int64  `protobuf:"varint,5,opt,name=docPageSize,proto3" json:"docPageSize,omitempty"` //文档页码数
+	DownTimes   int64  `protobuf:"varint,6,opt,name=downTimes,proto3" json:"downTimes,omitempty"`     //下载次数
+	UploadDate  string `protobuf:"bytes,7,opt,name=uploadDate,proto3" json:"uploadDate,omitempty"`    //上传时间
 	DocSummary  string `protobuf:"bytes,8,opt,name=docSummary,proto3" json:"docSummary,omitempty"`    //摘要
 }
 
@@ -264,37 +272,37 @@ func (x *Doc) GetDocName() string {
 	return ""
 }
 
-func (x *Doc) GetDocType() int32 {
+func (x *Doc) GetPrice() int64 {
 	if x != nil {
-		return x.DocType
+		return x.Price
 	}
 	return 0
 }
 
-func (x *Doc) GetDocFileSize() int32 {
+func (x *Doc) GetDocFileSize() int64 {
 	if x != nil {
 		return x.DocFileSize
 	}
 	return 0
 }
 
-func (x *Doc) GetDocPageSize() int32 {
+func (x *Doc) GetDocPageSize() int64 {
 	if x != nil {
 		return x.DocPageSize
 	}
 	return 0
 }
 
-func (x *Doc) GetTags() string {
+func (x *Doc) GetDownTimes() int64 {
 	if x != nil {
-		return x.Tags
+		return x.DownTimes
 	}
-	return ""
+	return 0
 }
 
-func (x *Doc) GetUserId() string {
+func (x *Doc) GetUploadDate() string {
 	if x != nil {
-		return x.UserId
+		return x.UploadDate
 	}
 	return ""
 }
@@ -917,134 +925,138 @@ var File_stdlib_proto protoreflect.FileDescriptor
 
 var file_stdlib_proto_rawDesc = []byte{
 	0x0a, 0x0c, 0x73, 0x74, 0x64, 0x6c, 0x69, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x06,
-	0x73, 0x74, 0x64, 0x6c, 0x69, 0x62, 0x22, 0xff, 0x01, 0x0a, 0x0f, 0x44, 0x6f, 0x63, 0x51, 0x75,
+	0x73, 0x74, 0x64, 0x6c, 0x69, 0x62, 0x22, 0xa7, 0x02, 0x0a, 0x0f, 0x44, 0x6f, 0x63, 0x51, 0x75,
 	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, 0x05, 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,
-	0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x70, 0x61, 0x67, 0x65, 0x53, 0x69, 0x7a, 0x65,
-	0x12, 0x1a, 0x0a, 0x08, 0x6b, 0x65, 0x79, 0x57, 0x6f, 0x72, 0x64, 0x73, 0x18, 0x03, 0x20, 0x01,
-	0x28, 0x09, 0x52, 0x08, 0x6b, 0x65, 0x79, 0x57, 0x6f, 0x72, 0x64, 0x73, 0x12, 0x18, 0x0a, 0x07,
-	0x69, 0x74, 0x65, 0x6d, 0x41, 0x72, 0x72, 0x18, 0x04, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x69,
-	0x74, 0x65, 0x6d, 0x41, 0x72, 0x72, 0x12, 0x16, 0x0a, 0x06, 0x74, 0x61, 0x67, 0x41, 0x72, 0x72,
-	0x18, 0x05, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x74, 0x61, 0x67, 0x41, 0x72, 0x72, 0x12, 0x28,
-	0x0a, 0x0f, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x73, 0x68, 0x54, 0x69, 0x6d, 0x65, 0x53, 0x6f, 0x72,
-	0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0f, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x73, 0x68,
-	0x54, 0x69, 0x6d, 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, 0x05, 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, 0x05, 0x52, 0x08,
-	0x76, 0x69, 0x65, 0x77, 0x53, 0x6f, 0x72, 0x74, 0x22, 0x6f, 0x0a, 0x10, 0x44, 0x6f, 0x63, 0x51,
-	0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04,
+	0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x70, 0x61, 0x67, 0x65, 0x53, 0x69, 0x7a, 0x65,
+	0x12, 0x18, 0x0a, 0x07, 0x6b, 0x65, 0x79, 0x57, 0x6f, 0x72, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28,
+	0x09, 0x52, 0x07, 0x6b, 0x65, 0x79, 0x57, 0x6f, 0x72, 0x64, 0x12, 0x24, 0x0a, 0x0d, 0x63, 0x6c,
+	0x61, 0x73, 0x73, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x4f, 0x6e, 0x65, 0x18, 0x04, 0x20, 0x03, 0x28,
+	0x09, 0x52, 0x0d, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x4f, 0x6e, 0x65,
+	0x12, 0x24, 0x0a, 0x0d, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x54, 0x77,
+	0x6f, 0x18, 0x05, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0d, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x4c, 0x65,
+	0x76, 0x65, 0x6c, 0x54, 0x77, 0x6f, 0x12, 0x10, 0x0a, 0x03, 0x74, 0x61, 0x67, 0x18, 0x06, 0x20,
+	0x03, 0x28, 0x09, 0x52, 0x03, 0x74, 0x61, 0x67, 0x12, 0x26, 0x0a, 0x0e, 0x75, 0x70, 0x64, 0x61,
+	0x74, 0x65, 0x44, 0x61, 0x74, 0x65, 0x53, 0x6f, 0x72, 0x74, 0x18, 0x07, 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, 0x08, 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, 0x09, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x76, 0x69, 0x65, 0x77, 0x53, 0x6f, 0x72, 0x74,
+	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, 0xed, 0x01, 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, 0x1e, 0x0a, 0x0a, 0x75, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x44, 0x61, 0x74, 0x65, 0x18,
+	0x07, 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,
+	0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x64, 0x6f, 0x63, 0x53, 0x75, 0x6d, 0x6d, 0x61, 0x72,
+	0x79, 0x22, 0x36, 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, 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, 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, 0x05, 0x52, 0x05, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x22, 0xdf, 0x01, 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, 0x18, 0x0a, 0x07, 0x64, 0x6f, 0x63, 0x54, 0x79, 0x70, 0x65, 0x18, 0x03, 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, 0x04, 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, 0x05, 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, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74,
-	0x61, 0x67, 0x73, 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, 0x1e, 0x0a, 0x0a, 0x64,
-	0x6f, 0x63, 0x53, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52,
-	0x0a, 0x64, 0x6f, 0x63, 0x53, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x22, 0x36, 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, 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, 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,
+	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, 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,
+	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 (

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

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

+ 24 - 0
rpc/stdlib/test/docquery_test.go

@@ -0,0 +1,24 @@
+package test
+
+import (
+	"context"
+	"log"
+	"testing"
+	"time"
+
+	"app.yhyue.com/moapp/jy_docs/rpc/stdlib/stdlib"
+	"app.yhyue.com/moapp/jy_docs/rpc/stdlib/stdlibclient"
+	"github.com/tal-tech/go-zero/core/discov"
+	"github.com/tal-tech/go-zero/zrpc"
+)
+
+func Test_Docquery(t *testing.T) {
+	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"}}))
+	res, err := std.DocQuery(ctx, &stdlib.DocQueryRequest{KeyWords: "test"})
+	if err != nil {
+		log.Println(err)
+	} else {
+		log.Println(res)
+	}
+}

+ 26 - 6
rpc/userlib/internal/logic/docdownloadlogic.go

@@ -25,17 +25,37 @@ func NewDocDownloadLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DocDo
 		Logger: logx.WithContext(ctx),
 	}
 }
+
 //转存操作
 func (l *DocDownloadLogic) DocDownload(in *userlib.UserCollectRequest) (*userlib.UserCollectResponse, error) {
-	b := userLibService.UserDocDownload(
+	b, msg := userLibService.UserDocDownload(
 		&model.UserDoc{
 			UserId:          in.UserId,
 			DocId:           in.DocId,
+<<<<<<< HEAD
+			DocCategory:     int(in.DocCategory),
+			IsDelete:        int(userlib.UserDocStatus_Normal),
+			DocName:         in.DocName,
+			DocFileType:     int(in.DocFileType),
+			DocFileSuffix:   in.DocFileSuffix,
+			DocFileSize:     int(in.DocFileSize),
+			DocPageSize:     int(in.DocPageSize),
+			DocSummary:      in.DocSummary,
+			DocSourceUserId: in.SourceUserId,
+		}, int(in.Cost), config.Configs.FileSystemConf.Etcd.Hosts, config.Configs.FileSystemConf.Etcd.Key)
+=======
 		}, int(in.Cost),config.Configs.FileSystemConf.Etcd.Hosts,config.Configs.FileSystemConf.Etcd.Key)
+>>>>>>> da3594f67ecdc12ecfff7b4a4a66f0ffb82bf39b
 	log.Printf("用户文档收藏,userId:[%s],docId:[%s] 是否成功:[%v]", in.UserId, in.DocId, b)
-	return &userlib.UserCollectResponse{
-		Code:    200,
-		Message: "success",
-	}, nil
-	return &userlib.UserCollectResponse{}, nil
+	if b {
+		return &userlib.UserCollectResponse{
+			Code:    int32(1),
+			Message: msg,
+		}, nil
+	} else {
+		return &userlib.UserCollectResponse{
+			Code:    int32(0),
+			Message: msg,
+		}, nil
+	}
 }

+ 4 - 4
rpc/userlib/test/userLib_test.go

@@ -67,18 +67,18 @@ func Test_UserDocDelete(t *testing.T)  {
 func Test_UserDocDwnload(t *testing.T) {
 	client := zrpc.MustNewClient(zrpc.RpcClientConf{
 		Etcd: discov.EtcdConf{
-			Hosts: []string{"127.0.0.1:2379"},
+			Hosts: []string{"127.0.0.1:2380"},
 			Key:   "jydocs.userlib.rpc",
 		},
 	})
 	userLib := userlibclient.NewUserLib(client)
 	resp, err := userLib.DocDownload(context.Background(), &userlibclient.UserCollectRequest{
-		DocId:        "1",
+		DocId:        "123",
 		UserId:       "wh5",
-		Cost:100,
+		Cost:1000,
 	})
 	if err != nil {
 		log.Println("UserDoc Collect call error:", err)
 	}
-	log.Print("UserDoc Collect call response:", resp)
+	log.Print("UserDoc Collect call response:", resp.Message,resp.Code)
 }

+ 76 - 3
services/stdlib/docService.go

@@ -1,14 +1,87 @@
 package stdlib
 
 import (
-	jyDocsRpcUtil "app.yhyue.com/moapp/jy_docs/services/util"
+	"fmt"
 	"log"
+	"regexp"
+	"strings"
+
+	jyDocsRpcUtil "app.yhyue.com/moapp/jy_docs/services/util"
+	"app.yhyue.com/moapp/jybase/common"
+	elastic "app.yhyue.com/moapp/jybase/esv7"
+)
+
+const (
+	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_Append    = `,"_source":["title","publishtime"],"sort":{%s},"from":%d,"size":%d,"highlight":{"fields":{"docName":{},"docSummary":{}}}`
+	Multi_Match        = `{"multi_match":{"query":"%s","fields":["docName","docSummary"]}}`
+	Multi_Match_Phrase = `{"multi_match":{"query":"%s","fields":["docName.docName_c","docSummary.docSummary_c"],"type":"phrase"}}`
+	Terms              = `{"trems":{"%s":[%s]}}`
+)
+
+var (
+	Reg = regexp.MustCompile(`\s+`)
 )
 
 func FindDocumentById(id int) {
 	log.Println(jyDocsRpcUtil.GetJyDocsDB().Exec("select * from ").Error)
 }
 
-func FindDocumentsByKeyWords(keyWords string, pageNum int) {
-
+func FindDocumentsByKeyWords(keyWord string, classLevelOne, classLevelTwo, tag []string, publishTimeSort, downloadSort, viewSort, pageNum, pageSize int64) (int64, *[]map[string]interface{}) {
+	defer common.Catch()
+	keyWord = strings.TrimSpace(keyWord)
+	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(classLevelOne) > 0 {
+		musts = append(musts, fmt.Sprintf(Terms, "docClassLevelOne", strings.Join(classLevelOne, ",")))
+	}
+	//二级分类
+	if len(classLevelTwo) > 0 {
+		musts = append(musts, fmt.Sprintf(Terms, "docClassLevelTwo", strings.Join(classLevelTwo, ",")))
+	}
+	//标签
+	if len(tag) > 0 {
+		musts = append(musts, fmt.Sprintf(Terms, "docTags", strings.Join(tag, ",")))
+	}
+	//搜索词
+	if keyWord != "" {
+		for _, v := range strings.Split(keyWord, " ") {
+			v = strings.ReplaceAll(v, `"`, `\"`)
+			musts = append(musts, fmt.Sprintf(Multi_Match, v))
+			negative_musts = append(negative_musts, fmt.Sprintf(Multi_Match_Phrase, v))
+		}
+	}
+	if len(musts) == 0 {
+		return 0, nil
+	}
+	query := ""
+	if keyWord != "" {
+		query = Es_Query_Boosting
+	} else {
+		query = Es_Query_Bool
+	}
+	query = fmt.Sprintf(query, strings.Join(musts, ","), fmt.Sprintf(Es_Query_Append, strings.Join(sorts, ","), (pageNum-1)*pageSize, pageSize))
+	log.Println("query:", query)
+	return elastic.DfsGet(jyDocsRpcUtil.Es_JyDoc, "", query)
 }

+ 34 - 12
services/userlib/userDocService.go

@@ -7,6 +7,7 @@ import (
 	"app.yhyue.com/moapp/jy_docs/services/model"
 	docRpcUtil "app.yhyue.com/moapp/jy_docs/services/util"
 	"context"
+	"errors"
 	"github.com/tal-tech/go-zero/core/discov"
 	"github.com/tal-tech/go-zero/zrpc"
 	"gorm.io/gorm"
@@ -111,8 +112,9 @@ func UserDocCancelCollect(userDocId string) bool {
 }
 
 //转存操作
-func UserDocDownload(userDoc *model.UserDoc, cost int,hosts []string,key string) bool {
+func UserDocDownload(userDoc *model.UserDoc, cost int,hosts []string,key string) (bool,string) {
 	log.Println("UserDocCollect exec ......")
+	msg:="转存成功"
 	err := docRpcUtil.GetJyDocsDB().Transaction(func(tx *gorm.DB) error {
 		//用户文库表添加记录
 		//获取文档有关信息
@@ -120,11 +122,13 @@ func UserDocDownload(userDoc *model.UserDoc, cost int,hosts []string,key string)
 		userDocDownloadList := []model.UserDoc{}
 		err := docRpcUtil.GetJyDocsDB().Table("user_doc").Where(" userId=? and docId=? and docCategory=? and (isDelete=? or isDelete=?)", userDoc.UserId, userDoc.DocId, model.UserDocCategory_Download, model.UserDocStatus_Normal, model.UserDocStatus_LogicDelete).Find(&userDocDownloadList)
 		if err.Error != nil {
+			log.Println("查询转存记录失败:",err)
+			msg="查询转存记录失败"
 			return err.Error
 		}
 		if len(userDocDownloadList) > 0 {
-			return nil
-		}
+			msg="之前已经下载不能再次下载"
+			return errors.New("之前已经下载不能再次下载")}
 		//先扣除积分
 		//rpc
 		client := zrpc.MustNewClient(zrpc.RpcClientConf{
@@ -143,30 +147,43 @@ func UserDocDownload(userDoc *model.UserDoc, cost int,hosts []string,key string)
 		res, pointsErr := integralLib.IntegralConsume(context.Background(), req)
 		log.Println("err ", pointsErr)
 		log.Println("req ", res)
-		if (pointsErr != nil || res.Code == 0) {
+		if (pointsErr != nil ) {
+			log.Println("扣除积分失败:",pointsErr)
+			msg="扣除积分失败"
 			return pointsErr
 		}
-
+		if (res.Code == 0) {
+			log.Println("扣除积分失败:",pointsErr)
+			msg=res.Message
+			return  errors.New(res.Message)
+		}
 		//查询之前有无收藏记录 有收藏记录类型改为下载,状态改为未删除、有收藏记录插入一条新纪录
 		userDocCollectionList := []model.UserDoc{}
 		err = docRpcUtil.GetJyDocsDB().Table("user_doc").Where(" userId=? and docId=? and docCategory=? and (isDelete=? or isDelete=?)", userDoc.UserId, userDoc.DocId, model.UserDocCategory_Collect, model.UserDocStatus_Normal, model.UserDocStatus_LogicDelete).Find(&userDocCollectionList)
 		if err.Error != nil {
+			log.Println("收藏记录查询:",err)
+			msg="收藏记录查询"
 			return err.Error
 		}
 		if len(userDocCollectionList) > 0 {
 			//修改收藏为下载
 			if err := tx.Exec("update user_doc set docCategory=? , isDelete=?  ,update_at=?  where  id =?", model.UserDocCategory_Download, model.UserDocStatus_Normal, time.Now(), userDocCollectionList[0].ID).Error; err != nil {
+				log.Println("收藏记录更改为转存记录失败:",err)
+				msg="收藏记录更改为转存记录失败"
+				tx.Rollback()
 				return err
 			}
 			if err.Error != nil {
-				log.Println("userDocCollect error:", err)
+				log.Println("转存操作流水添加失败:", err)
+				msg="收藏记录更改为转存记录失败"
 				tx.Rollback()
 				return err.Error
 			}
 			//用户收藏、转存记录表添加记录
 			err := docRpcUtil.GetJyDocsDB().Exec("insert into download_collection_record (docId,userId,sourceUserId,category,cost,date) values (?,?,?,?,?,?)", userDoc.DocId, userDoc.UserId, userDoc.DocSourceUserId, model.UserDocCategory_Download, cost, time.Now())
 			if err.Error != nil {
-				log.Println("userDocCollect record insert error:", err)
+				log.Println("转存操作流水添加失败:", err)
+				msg="转存操作流水添加失败"
 				tx.Rollback()
 				return err.Error
 			}
@@ -175,6 +192,8 @@ func UserDocDownload(userDoc *model.UserDoc, cost int,hosts []string,key string)
 			userDoc.CreateAt = time.Now()
 			userDoc.UpdateAt = time.Now()
 			userDoc.DeletedAt = time.Now()
+			//获取文件基本信息
+
 			//查询文档基础信息
 			doc := model.Doc{}
 			err0 := docRpcUtil.GetJyDocsDB().
@@ -182,7 +201,8 @@ func UserDocDownload(userDoc *model.UserDoc, cost int,hosts []string,key string)
 				Find(&doc)
 			if err0 != nil {
 				log.Println("文档不存在")
-				return nil
+				msg="文档不存在"
+				return errors.New("文档不存在")
 			}
 			userDoc.DocSourceUserId = doc.UserId
 			userDoc.DocCategory = doc.DocFileType
@@ -195,14 +215,16 @@ func UserDocDownload(userDoc *model.UserDoc, cost int,hosts []string,key string)
 			userDoc.DocSummary = doc.DocSummary
 			err = docRpcUtil.GetJyDocsDB().Create(userDoc)
 			if err.Error != nil {
-				log.Println("userDocCollect error:", err)
+				log.Println("转存操作添加失败:", err)
+				msg="转存操作添加失败"
 				tx.Rollback()
 				return err.Error
 			}
 			//用户收藏、转存记录表添加记录
 			err := docRpcUtil.GetJyDocsDB().Exec("insert into download_collection_record (docId,userId,sourceUserId,category,cost,date) values (?,?,?,?,?,?)", userDoc.DocId, userDoc.UserId, userDoc.DocSourceUserId, model.UserDocCategory_Download, cost, time.Now())
 			if err.Error != nil {
-				log.Println("userDocCollect record insert error:", err)
+				log.Println("转存操作流水添加失败:", err)
+				msg="转存操作流水添加失败"
 				tx.Rollback()
 				return err.Error
 			}
@@ -210,9 +232,9 @@ func UserDocDownload(userDoc *model.UserDoc, cost int,hosts []string,key string)
 		return nil
 	})
 	if err != nil {
-		return false
+		return false,msg
 	}
-	return true
+	return true,msg
 }
 func UserDocDelete(docId string) bool {
 	err := docRpcUtil.GetJyDocsDB().Transaction(func(tx *gorm.DB) error {

+ 8 - 2
services/util/util.go

@@ -1,5 +1,9 @@
 package util
 
+const (
+	Es_JyDoc = "jydoc" //es中文库的别名
+)
+
 var (
 	/*_id 文档id 类型:string
 	 *文档名:docName 类型:string
@@ -10,7 +14,9 @@ var (
 	 *下载次数:downTimes 类型:long
 	 *浏览次数:viewTimes 类型:long
 	 *文档摘要:docSummary 类型:string
-	 *上传时间:create_at 类型:date 格式:yyyy-MM-dd HH:mm:ss
+	 *上传时间:uploadDate 类型:date 格式:yyyy-MM-dd HH:mm:ss
+	 *文件大小:docFileSize 类型:long
+	 *页码数:docPageSize 类型:long
 	 */
-	EsMapping = []string{"id", "docName", "docTags", "docClassLevelOne", "docClassLevelTwo", "price", "downTimes", "viewTimes", "docSummary", "create_at"}
+	EsMapping = []string{"_id", "docName", "docTags", "docClassLevelOne", "docClassLevelTwo", "price", "downTimes", "viewTimes", "docSummary", "uploadDate", "docFileSize", "docPageSize"}
 )