李哲 4 anos atrás
pai
commit
7523879148

+ 40 - 0
rpc/userlib/internal/logic/doccancelcollectlogic.go

@@ -0,0 +1,40 @@
+package logic
+
+import (
+	userLibService "app.yhyue.com/moapp/jy_docs/services/userlib"
+	"context"
+	"log"
+
+	"app.yhyue.com/moapp/jy_docs/rpc/userlib/internal/svc"
+	"app.yhyue.com/moapp/jy_docs/rpc/userlib/userlib"
+
+	"github.com/tal-tech/go-zero/core/logx"
+)
+
+type DocCancelCollectLogic struct {
+	ctx    context.Context
+	svcCtx *svc.ServiceContext
+	logx.Logger
+}
+
+func NewDocCancelCollectLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DocCancelCollectLogic {
+	return &DocCancelCollectLogic{
+		ctx:    ctx,
+		svcCtx: svcCtx,
+		Logger: logx.WithContext(ctx),
+	}
+}
+
+func (l *DocCancelCollectLogic) DocCancelCollect(in *userlib.UserDeleteRequest) (*userlib.UserDeleteResponse, error) {
+	// todo: add your logic here and delete this line
+	result := &userlib.UserDeleteResponse{}
+	b := userLibService.UserDocCancelCollect(in.DocId)
+	if b {
+		result.Code = 200
+		result.Message = "取消收藏成功"
+	}
+	result.Code = 400
+	result.Message = "取消收藏失败"
+	log.Printf("用户文档取消收藏,userId:[%s],docId:[%s] 是否成功:[%v]", in.DocId, b)
+	return result, nil
+}

+ 0 - 10
rpc/userlib/internal/logic/doccollectlogic.go

@@ -32,16 +32,6 @@ func (l *DocCollectLogic) DocCollect(in *userlib.UserCollectRequest) (*userlib.U
 		&model.UserDoc{
 			UserId:          in.UserId,
 			DocId:           in.DocId,
-
-			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))
 	log.Printf("用户文档收藏,userId:[%s],docId:[%s] 是否成功:[%v]", in.UserId, in.DocId, b)
 	return &userlib.UserCollectResponse{

+ 0 - 9
rpc/userlib/internal/logic/docdownloadlogic.go

@@ -31,15 +31,6 @@ func (l *DocDownloadLogic) DocDownload(in *userlib.UserCollectRequest) (*userlib
 		&model.UserDoc{
 			UserId:          in.UserId,
 			DocId:           in.DocId,
-			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)
 	log.Printf("用户文档收藏,userId:[%s],docId:[%s] 是否成功:[%v]", in.UserId, in.DocId, b)
 	return &userlib.UserCollectResponse{

+ 5 - 0
rpc/userlib/internal/server/userlibserver.go

@@ -31,6 +31,11 @@ func (s *UserLibServer) DocCollect(ctx context.Context, in *userlib.UserCollectR
 	return l.DocCollect(in)
 }
 
+func (s *UserLibServer) DocCancelCollect(ctx context.Context, in *userlib.UserDeleteRequest) (*userlib.UserDeleteResponse, error) {
+	l := logic.NewDocCancelCollectLogic(ctx, s.svcCtx)
+	return l.DocCancelCollect(in)
+}
+
 func (s *UserLibServer) DocDelete(ctx context.Context, in *userlib.UserDeleteRequest) (*userlib.UserDeleteResponse, error) {
 	l := logic.NewDocDeleteLogic(ctx, s.svcCtx)
 	return l.DocDelete(in)

+ 23 - 20
rpc/userlib/test/userLib_test.go

@@ -13,23 +13,33 @@ import (
 func Test_UserDocCollect(t *testing.T) {
 	client := zrpc.MustNewClient(zrpc.RpcClientConf{
 		Etcd: discov.EtcdConf{
-			Hosts: []string{"192.168.3.240:2379"},
+			Hosts: []string{"127.0.0.1:2379"},
 			Key:   "jydocs.userlib.rpc",
 		},
 	})
 	userLib := userlibclient.NewUserLib(client)
 	resp, err := userLib.DocCollect(context.Background(), &userlibclient.UserCollectRequest{
-
-		/*DocId:        "1",
+		DocId:        "1",
 		UserId:       "1",
-		SourceUserId: "2",
-		DocName:      "2020招标文件白皮书.docx",
-		DocFileType:  userlib.UserDocFileType_Word,
-		DocFileSize:  1002,
-		DocPageSize:  20,
-		DocCategory:  userlib.UserDocCategory_Collect,
-		DocFileSuffix:"docx",
-		Cost:0,*/
+		Cost: 0,
+	})
+	if err != nil {
+		log.Println("UserDoc Collect call error:", err)
+	}
+	log.Print("UserDoc Collect call response:", resp)
+}
+
+//用户取消收藏单元测试
+func Test_UserCancelDocCollect(t *testing.T) {
+	client := zrpc.MustNewClient(zrpc.RpcClientConf{
+		Etcd: discov.EtcdConf{
+			Hosts: []string{"127.0.0.1:2379"},
+			Key:   "jydocs.userlib.rpc",
+		},
+	})
+	userLib := userlibclient.NewUserLib(client)
+	resp, err := userLib.DocCancelCollect(context.Background(), &userlibclient.UserDeleteRequest{
+		DocId:        "5",
 	})
 	if err != nil {
 		log.Println("UserDoc Collect call error:", err)
@@ -40,13 +50,13 @@ func Test_UserDocCollect(t *testing.T) {
 func Test_UserDocDelete(t *testing.T)  {
 	client := zrpc.MustNewClient(zrpc.RpcClientConf{
 		Etcd: discov.EtcdConf{
-			Hosts: []string{"192.168.3.240:2379"},
+			Hosts: []string{"127.0.0.1:2379"},
 			Key:   "jydocs.userlib.rpc",
 		},
 	})
 	userLib := userlibclient.NewUserLib(client)
 	resp, err := userLib.DocDelete(context.Background(), &userlibclient.UserDeleteRequest{
-		//DocId: "8",
+		DocId: "1",
 	})
 	if err != nil {
 		log.Println("UserDoc Collect call error:", err)
@@ -65,13 +75,6 @@ func Test_UserDocDwnload(t *testing.T) {
 	resp, err := userLib.DocDownload(context.Background(), &userlibclient.UserCollectRequest{
 		DocId:        "1",
 		UserId:       "wh5",
-		SourceUserId: "2",
-		DocName:      "2020招标文件白皮书.docx",
-		DocFileType:  userlib.UserDocFileType_Word,
-		DocFileSize:  1002,
-		DocPageSize:  20,
-		DocCategory:  userlib.UserDocCategory_Collect,
-		DocFileSuffix:"docx",
 		Cost:100,
 	})
 	if err != nil {

+ 2 - 9
rpc/userlib/userlib.proto

@@ -21,15 +21,7 @@ enum UserDocFileType {
 message UserCollectRequest {
     string userId=1; //用户id
     string docId=2; //文档id
-    string sourceUserId=3; //原文档用户id
-    UserDocCategory docCategory=4;//文档类别
-    string docName =5;//文档名称
-    UserDocFileType docFileType=6;//文档类型
-    string docFileSuffix=7;//文档后缀
-    int32 docFileSize=8;//文档大小
-    int32 docPageSize=9;//页码数目
-    string docSummary=10;//文档摘要
-    int32 cost=11;//收藏|转存费用
+    int32 cost=3;//收藏|转存费用
 }
 
 message UserCollectResponse {
@@ -80,6 +72,7 @@ enum UserDocStatus {
 service  UserLib {
     rpc UserDocs(UserDocsRequest) returns (UserDocsResponse);//用户文档列表
   	rpc DocCollect(UserCollectRequest) returns(UserCollectResponse); //文档收藏
+  	rpc DocCancelCollect(UserDeleteRequest) returns(UserDeleteResponse); //文档取消收藏
 	rpc DocDelete(UserDeleteRequest) returns(UserDeleteResponse); //文档删除
 	rpc DocRestore(UserRestoreRequest) returns(UserRestoreResponse); //文档恢复
 	rpc DocDownload(UserCollectRequest) returns(UserCollectResponse); //文档转存

+ 140 - 183
rpc/userlib/userlib/userlib.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.1
+// 	protoc        v3.15.3
 // source: userlib.proto
 
 package userlib
@@ -193,17 +193,9 @@ type UserCollectRequest struct {
 	sizeCache     protoimpl.SizeCache
 	unknownFields protoimpl.UnknownFields
 
-	UserId        string          `protobuf:"bytes,1,opt,name=userId,proto3" json:"userId,omitempty"`                                         //用户id
-	DocId         string          `protobuf:"bytes,2,opt,name=docId,proto3" json:"docId,omitempty"`                                           //文档id
-	SourceUserId  string          `protobuf:"bytes,3,opt,name=sourceUserId,proto3" json:"sourceUserId,omitempty"`                             //原文档用户id
-	DocCategory   UserDocCategory `protobuf:"varint,4,opt,name=docCategory,proto3,enum=userlib.UserDocCategory" json:"docCategory,omitempty"` //文档类别
-	DocName       string          `protobuf:"bytes,5,opt,name=docName,proto3" json:"docName,omitempty"`                                       //文档名称
-	DocFileType   UserDocFileType `protobuf:"varint,6,opt,name=docFileType,proto3,enum=userlib.UserDocFileType" json:"docFileType,omitempty"` //文档类型
-	DocFileSuffix string          `protobuf:"bytes,7,opt,name=docFileSuffix,proto3" json:"docFileSuffix,omitempty"`                           //文档后缀
-	DocFileSize   int32           `protobuf:"varint,8,opt,name=docFileSize,proto3" json:"docFileSize,omitempty"`                              //文档大小
-	DocPageSize   int32           `protobuf:"varint,9,opt,name=docPageSize,proto3" json:"docPageSize,omitempty"`                              //页码数目
-	DocSummary    string          `protobuf:"bytes,10,opt,name=docSummary,proto3" json:"docSummary,omitempty"`                                //文档摘要
-	Cost          int32           `protobuf:"varint,11,opt,name=cost,proto3" json:"cost,omitempty"`                                           //收藏|转存费用
+	UserId string `protobuf:"bytes,1,opt,name=userId,proto3" json:"userId,omitempty"` //用户id
+	DocId  string `protobuf:"bytes,2,opt,name=docId,proto3" json:"docId,omitempty"`   //文档id
+	Cost   int32  `protobuf:"varint,3,opt,name=cost,proto3" json:"cost,omitempty"`    //收藏|转存费用
 }
 
 func (x *UserCollectRequest) Reset() {
@@ -252,62 +244,6 @@ func (x *UserCollectRequest) GetDocId() string {
 	return ""
 }
 
-func (x *UserCollectRequest) GetSourceUserId() string {
-	if x != nil {
-		return x.SourceUserId
-	}
-	return ""
-}
-
-func (x *UserCollectRequest) GetDocCategory() UserDocCategory {
-	if x != nil {
-		return x.DocCategory
-	}
-	return UserDocCategory_SelfUpload
-}
-
-func (x *UserCollectRequest) GetDocName() string {
-	if x != nil {
-		return x.DocName
-	}
-	return ""
-}
-
-func (x *UserCollectRequest) GetDocFileType() UserDocFileType {
-	if x != nil {
-		return x.DocFileType
-	}
-	return UserDocFileType_Word
-}
-
-func (x *UserCollectRequest) GetDocFileSuffix() string {
-	if x != nil {
-		return x.DocFileSuffix
-	}
-	return ""
-}
-
-func (x *UserCollectRequest) GetDocFileSize() int32 {
-	if x != nil {
-		return x.DocFileSize
-	}
-	return 0
-}
-
-func (x *UserCollectRequest) GetDocPageSize() int32 {
-	if x != nil {
-		return x.DocPageSize
-	}
-	return 0
-}
-
-func (x *UserCollectRequest) GetDocSummary() string {
-	if x != nil {
-		return x.DocSummary
-	}
-	return ""
-}
-
 func (x *UserCollectRequest) GetCost() int32 {
 	if x != nil {
 		return x.Cost
@@ -763,112 +699,97 @@ var File_userlib_proto protoreflect.FileDescriptor
 
 var file_userlib_proto_rawDesc = []byte{
 	0x0a, 0x0d, 0x75, 0x73, 0x65, 0x72, 0x6c, 0x69, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12,
-	0x07, 0x75, 0x73, 0x65, 0x72, 0x6c, 0x69, 0x62, 0x22, 0x96, 0x03, 0x0a, 0x12, 0x55, 0x73, 0x65,
-	0x72, 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12,
-	0x16, 0x0a, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52,
-	0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x64, 0x6f, 0x63, 0x49, 0x64,
-	0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x64, 0x6f, 0x63, 0x49, 0x64, 0x12, 0x22, 0x0a,
-	0x0c, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x55, 0x73, 0x65, 0x72, 0x49, 0x64, 0x18, 0x03, 0x20,
-	0x01, 0x28, 0x09, 0x52, 0x0c, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x55, 0x73, 0x65, 0x72, 0x49,
-	0x64, 0x12, 0x3a, 0x0a, 0x0b, 0x64, 0x6f, 0x63, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79,
-	0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x18, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x6c, 0x69, 0x62,
-	0x2e, 0x55, 0x73, 0x65, 0x72, 0x44, 0x6f, 0x63, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79,
-	0x52, 0x0b, 0x64, 0x6f, 0x63, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x12, 0x18, 0x0a,
-	0x07, 0x64, 0x6f, 0x63, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07,
-	0x64, 0x6f, 0x63, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x3a, 0x0a, 0x0b, 0x64, 0x6f, 0x63, 0x46, 0x69,
-	0x6c, 0x65, 0x54, 0x79, 0x70, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x18, 0x2e, 0x75,
-	0x73, 0x65, 0x72, 0x6c, 0x69, 0x62, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x44, 0x6f, 0x63, 0x46, 0x69,
-	0x6c, 0x65, 0x54, 0x79, 0x70, 0x65, 0x52, 0x0b, 0x64, 0x6f, 0x63, 0x46, 0x69, 0x6c, 0x65, 0x54,
-	0x79, 0x70, 0x65, 0x12, 0x24, 0x0a, 0x0d, 0x64, 0x6f, 0x63, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x75,
-	0x66, 0x66, 0x69, 0x78, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x64, 0x6f, 0x63, 0x46,
-	0x69, 0x6c, 0x65, 0x53, 0x75, 0x66, 0x66, 0x69, 0x78, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x6f, 0x63,
-	0x46, 0x69, 0x6c, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x18, 0x08, 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, 0x09, 0x20, 0x01, 0x28, 0x05,
-	0x52, 0x0b, 0x64, 0x6f, 0x63, 0x50, 0x61, 0x67, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x1e, 0x0a,
-	0x0a, 0x64, 0x6f, 0x63, 0x53, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x18, 0x0a, 0x20, 0x01, 0x28,
-	0x09, 0x52, 0x0a, 0x64, 0x6f, 0x63, 0x53, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x12, 0x12, 0x0a,
-	0x04, 0x63, 0x6f, 0x73, 0x74, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x63, 0x6f, 0x73,
-	0x74, 0x22, 0x43, 0x0a, 0x13, 0x55, 0x73, 0x65, 0x72, 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74,
-	0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65,
-	0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x18, 0x0a, 0x07,
-	0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d,
-	0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x29, 0x0a, 0x11, 0x55, 0x73, 0x65, 0x72, 0x44, 0x65,
-	0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x64,
-	0x6f, 0x63, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x64, 0x6f, 0x63, 0x49,
-	0x64, 0x22, 0x42, 0x0a, 0x12, 0x55, 0x73, 0x65, 0x72, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52,
+	0x07, 0x75, 0x73, 0x65, 0x72, 0x6c, 0x69, 0x62, 0x22, 0x56, 0x0a, 0x12, 0x55, 0x73, 0x65, 0x72,
+	0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x16,
+	0x0a, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06,
+	0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x64, 0x6f, 0x63, 0x49, 0x64, 0x18,
+	0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x64, 0x6f, 0x63, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04,
+	0x63, 0x6f, 0x73, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x63, 0x6f, 0x73, 0x74,
+	0x22, 0x43, 0x0a, 0x13, 0x55, 0x73, 0x65, 0x72, 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x52,
+	0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18,
+	0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x6d,
+	0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65,
+	0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x29, 0x0a, 0x11, 0x55, 0x73, 0x65, 0x72, 0x44, 0x65, 0x6c,
+	0x65, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x64, 0x6f,
+	0x63, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x64, 0x6f, 0x63, 0x49, 0x64,
+	0x22, 0x42, 0x0a, 0x12, 0x55, 0x73, 0x65, 0x72, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65,
+	0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01,
+	0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65,
+	0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73,
+	0x73, 0x61, 0x67, 0x65, 0x22, 0x2a, 0x0a, 0x12, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x73, 0x74,
+	0x6f, 0x72, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x64, 0x6f,
+	0x63, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x64, 0x6f, 0x63, 0x49, 0x64,
+	0x22, 0x43, 0x0a, 0x13, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x52,
 	0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18,
 	0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x6d,
 	0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65,
-	0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x2a, 0x0a, 0x12, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x73,
-	0x74, 0x6f, 0x72, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x64,
-	0x6f, 0x63, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x64, 0x6f, 0x63, 0x49,
-	0x64, 0x22, 0x43, 0x0a, 0x13, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x73, 0x74, 0x6f, 0x72, 0x65,
+	0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x6d, 0x0a, 0x0f, 0x55, 0x73, 0x65, 0x72, 0x44, 0x6f, 0x63,
+	0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x75, 0x73, 0x65, 0x72,
+	0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64,
+	0x12, 0x42, 0x0a, 0x0f, 0x75, 0x73, 0x65, 0x72, 0x44, 0x6f, 0x63, 0x43, 0x61, 0x74, 0x65, 0x67,
+	0x6f, 0x72, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x18, 0x2e, 0x75, 0x73, 0x65, 0x72,
+	0x6c, 0x69, 0x62, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x44, 0x6f, 0x63, 0x43, 0x61, 0x74, 0x65, 0x67,
+	0x6f, 0x72, 0x79, 0x52, 0x0f, 0x75, 0x73, 0x65, 0x72, 0x44, 0x6f, 0x63, 0x43, 0x61, 0x74, 0x65,
+	0x67, 0x6f, 0x72, 0x79, 0x22, 0x40, 0x0a, 0x10, 0x55, 0x73, 0x65, 0x72, 0x44, 0x6f, 0x63, 0x73,
 	0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65,
 	0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x18, 0x0a, 0x07,
 	0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d,
-	0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x6d, 0x0a, 0x0f, 0x55, 0x73, 0x65, 0x72, 0x44, 0x6f,
-	0x63, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x75, 0x73, 0x65,
-	0x72, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49,
-	0x64, 0x12, 0x42, 0x0a, 0x0f, 0x75, 0x73, 0x65, 0x72, 0x44, 0x6f, 0x63, 0x43, 0x61, 0x74, 0x65,
-	0x67, 0x6f, 0x72, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x18, 0x2e, 0x75, 0x73, 0x65,
-	0x72, 0x6c, 0x69, 0x62, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x44, 0x6f, 0x63, 0x43, 0x61, 0x74, 0x65,
-	0x67, 0x6f, 0x72, 0x79, 0x52, 0x0f, 0x75, 0x73, 0x65, 0x72, 0x44, 0x6f, 0x63, 0x43, 0x61, 0x74,
-	0x65, 0x67, 0x6f, 0x72, 0x79, 0x22, 0x40, 0x0a, 0x10, 0x55, 0x73, 0x65, 0x72, 0x44, 0x6f, 0x63,
-	0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64,
-	0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x18, 0x0a,
-	0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07,
-	0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x91, 0x01, 0x0a, 0x13, 0x55, 0x73, 0x65, 0x72,
-	0x52, 0x65, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12,
-	0x16, 0x0a, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52,
-	0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x64, 0x6f, 0x63, 0x49, 0x64,
-	0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x64, 0x6f, 0x63, 0x49, 0x64, 0x12, 0x0e, 0x0a,
-	0x02, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x3c, 0x0a,
-	0x0d, 0x75, 0x73, 0x65, 0x72, 0x44, 0x6f, 0x63, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x04,
-	0x20, 0x01, 0x28, 0x0e, 0x32, 0x16, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x6c, 0x69, 0x62, 0x2e, 0x55,
-	0x73, 0x65, 0x72, 0x44, 0x6f, 0x63, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x0d, 0x75, 0x73,
-	0x65, 0x72, 0x44, 0x6f, 0x63, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2a, 0x3c, 0x0a, 0x0f, 0x55,
-	0x73, 0x65, 0x72, 0x44, 0x6f, 0x63, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x12, 0x0e,
-	0x0a, 0x0a, 0x53, 0x65, 0x6c, 0x66, 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x10, 0x00, 0x12, 0x0c,
-	0x0a, 0x08, 0x44, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x10, 0x01, 0x12, 0x0b, 0x0a, 0x07,
-	0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x10, 0x02, 0x2a, 0x4c, 0x0a, 0x0f, 0x55, 0x73, 0x65,
-	0x72, 0x44, 0x6f, 0x63, 0x46, 0x69, 0x6c, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x08, 0x0a, 0x04,
-	0x57, 0x6f, 0x72, 0x64, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, 0x50, 0x44, 0x46, 0x10, 0x01, 0x12,
-	0x09, 0x0a, 0x05, 0x45, 0x58, 0x43, 0x45, 0x4c, 0x10, 0x02, 0x12, 0x07, 0x0a, 0x03, 0x50, 0x50,
-	0x54, 0x10, 0x03, 0x12, 0x07, 0x0a, 0x03, 0x54, 0x58, 0x54, 0x10, 0x04, 0x12, 0x09, 0x0a, 0x05,
-	0x4f, 0x74, 0x68, 0x65, 0x72, 0x10, 0x05, 0x2a, 0x43, 0x0a, 0x0d, 0x55, 0x73, 0x65, 0x72, 0x44,
-	0x6f, 0x63, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x0a, 0x0a, 0x06, 0x4e, 0x6f, 0x72, 0x6d,
-	0x61, 0x6c, 0x10, 0x00, 0x12, 0x0f, 0x0a, 0x0b, 0x4c, 0x6f, 0x67, 0x69, 0x63, 0x44, 0x65, 0x6c,
-	0x65, 0x74, 0x65, 0x10, 0x01, 0x12, 0x15, 0x0a, 0x11, 0x50, 0x65, 0x72, 0x6d, 0x61, 0x6e, 0x65,
-	0x6e, 0x74, 0x6c, 0x79, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x10, 0x02, 0x32, 0xb6, 0x03, 0x0a,
-	0x07, 0x55, 0x73, 0x65, 0x72, 0x4c, 0x69, 0x62, 0x12, 0x3f, 0x0a, 0x08, 0x55, 0x73, 0x65, 0x72,
-	0x44, 0x6f, 0x63, 0x73, 0x12, 0x18, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x6c, 0x69, 0x62, 0x2e, 0x55,
-	0x73, 0x65, 0x72, 0x44, 0x6f, 0x63, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19,
-	0x2e, 0x75, 0x73, 0x65, 0x72, 0x6c, 0x69, 0x62, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x44, 0x6f, 0x63,
-	0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x47, 0x0a, 0x0a, 0x44, 0x6f, 0x63,
-	0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x12, 0x1b, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x6c, 0x69,
-	0x62, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x52, 0x65, 0x71,
-	0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x6c, 0x69, 0x62, 0x2e, 0x55,
-	0x73, 0x65, 0x72, 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
-	0x73, 0x65, 0x12, 0x44, 0x0a, 0x09, 0x44, 0x6f, 0x63, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x12,
-	0x1a, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x6c, 0x69, 0x62, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x44, 0x65,
-	0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1b, 0x2e, 0x75, 0x73,
+	0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x91, 0x01, 0x0a, 0x13, 0x55, 0x73, 0x65, 0x72, 0x52,
+	0x65, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x16,
+	0x0a, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06,
+	0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x64, 0x6f, 0x63, 0x49, 0x64, 0x18,
+	0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x64, 0x6f, 0x63, 0x49, 0x64, 0x12, 0x0e, 0x0a, 0x02,
+	0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x3c, 0x0a, 0x0d,
+	0x75, 0x73, 0x65, 0x72, 0x44, 0x6f, 0x63, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x04, 0x20,
+	0x01, 0x28, 0x0e, 0x32, 0x16, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x6c, 0x69, 0x62, 0x2e, 0x55, 0x73,
+	0x65, 0x72, 0x44, 0x6f, 0x63, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x0d, 0x75, 0x73, 0x65,
+	0x72, 0x44, 0x6f, 0x63, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2a, 0x3c, 0x0a, 0x0f, 0x55, 0x73,
+	0x65, 0x72, 0x44, 0x6f, 0x63, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x12, 0x0e, 0x0a,
+	0x0a, 0x53, 0x65, 0x6c, 0x66, 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x10, 0x00, 0x12, 0x0c, 0x0a,
+	0x08, 0x44, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x10, 0x01, 0x12, 0x0b, 0x0a, 0x07, 0x43,
+	0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x10, 0x02, 0x2a, 0x4c, 0x0a, 0x0f, 0x55, 0x73, 0x65, 0x72,
+	0x44, 0x6f, 0x63, 0x46, 0x69, 0x6c, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x08, 0x0a, 0x04, 0x57,
+	0x6f, 0x72, 0x64, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, 0x50, 0x44, 0x46, 0x10, 0x01, 0x12, 0x09,
+	0x0a, 0x05, 0x45, 0x58, 0x43, 0x45, 0x4c, 0x10, 0x02, 0x12, 0x07, 0x0a, 0x03, 0x50, 0x50, 0x54,
+	0x10, 0x03, 0x12, 0x07, 0x0a, 0x03, 0x54, 0x58, 0x54, 0x10, 0x04, 0x12, 0x09, 0x0a, 0x05, 0x4f,
+	0x74, 0x68, 0x65, 0x72, 0x10, 0x05, 0x2a, 0x43, 0x0a, 0x0d, 0x55, 0x73, 0x65, 0x72, 0x44, 0x6f,
+	0x63, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x0a, 0x0a, 0x06, 0x4e, 0x6f, 0x72, 0x6d, 0x61,
+	0x6c, 0x10, 0x00, 0x12, 0x0f, 0x0a, 0x0b, 0x4c, 0x6f, 0x67, 0x69, 0x63, 0x44, 0x65, 0x6c, 0x65,
+	0x74, 0x65, 0x10, 0x01, 0x12, 0x15, 0x0a, 0x11, 0x50, 0x65, 0x72, 0x6d, 0x61, 0x6e, 0x65, 0x6e,
+	0x74, 0x6c, 0x79, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x10, 0x02, 0x32, 0x83, 0x04, 0x0a, 0x07,
+	0x55, 0x73, 0x65, 0x72, 0x4c, 0x69, 0x62, 0x12, 0x3f, 0x0a, 0x08, 0x55, 0x73, 0x65, 0x72, 0x44,
+	0x6f, 0x63, 0x73, 0x12, 0x18, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x6c, 0x69, 0x62, 0x2e, 0x55, 0x73,
+	0x65, 0x72, 0x44, 0x6f, 0x63, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e,
+	0x75, 0x73, 0x65, 0x72, 0x6c, 0x69, 0x62, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x44, 0x6f, 0x63, 0x73,
+	0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x47, 0x0a, 0x0a, 0x44, 0x6f, 0x63, 0x43,
+	0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x12, 0x1b, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x6c, 0x69, 0x62,
+	0x2e, 0x55, 0x73, 0x65, 0x72, 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x52, 0x65, 0x71, 0x75,
+	0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x6c, 0x69, 0x62, 0x2e, 0x55, 0x73,
+	0x65, 0x72, 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
+	0x65, 0x12, 0x4b, 0x0a, 0x10, 0x44, 0x6f, 0x63, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x43, 0x6f,
+	0x6c, 0x6c, 0x65, 0x63, 0x74, 0x12, 0x1a, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x6c, 0x69, 0x62, 0x2e,
+	0x55, 0x73, 0x65, 0x72, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
+	0x74, 0x1a, 0x1b, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x6c, 0x69, 0x62, 0x2e, 0x55, 0x73, 0x65, 0x72,
+	0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x44,
+	0x0a, 0x09, 0x44, 0x6f, 0x63, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x12, 0x1a, 0x2e, 0x75, 0x73,
 	0x65, 0x72, 0x6c, 0x69, 0x62, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65,
-	0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x47, 0x0a, 0x0a, 0x44, 0x6f, 0x63, 0x52,
-	0x65, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x12, 0x1b, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x6c, 0x69, 0x62,
-	0x2e, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x52, 0x65, 0x71, 0x75,
+	0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1b, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x6c, 0x69,
+	0x62, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70,
+	0x6f, 0x6e, 0x73, 0x65, 0x12, 0x47, 0x0a, 0x0a, 0x44, 0x6f, 0x63, 0x52, 0x65, 0x73, 0x74, 0x6f,
+	0x72, 0x65, 0x12, 0x1b, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x6c, 0x69, 0x62, 0x2e, 0x55, 0x73, 0x65,
+	0x72, 0x52, 0x65, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a,
+	0x1c, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x6c, 0x69, 0x62, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65,
+	0x73, 0x74, 0x6f, 0x72, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x48, 0x0a,
+	0x0b, 0x44, 0x6f, 0x63, 0x44, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x12, 0x1b, 0x2e, 0x75,
+	0x73, 0x65, 0x72, 0x6c, 0x69, 0x62, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x43, 0x6f, 0x6c, 0x6c, 0x65,
+	0x63, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x75, 0x73, 0x65, 0x72,
+	0x6c, 0x69, 0x62, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x52,
+	0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x48, 0x0a, 0x0a, 0x44, 0x6f, 0x63, 0x52, 0x65,
+	0x63, 0x79, 0x63, 0x6c, 0x65, 0x12, 0x1c, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x6c, 0x69, 0x62, 0x2e,
+	0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75,
 	0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x6c, 0x69, 0x62, 0x2e, 0x55, 0x73,
-	0x65, 0x72, 0x52, 0x65, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
-	0x65, 0x12, 0x48, 0x0a, 0x0b, 0x44, 0x6f, 0x63, 0x44, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64,
-	0x12, 0x1b, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x6c, 0x69, 0x62, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x43,
-	0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e,
-	0x75, 0x73, 0x65, 0x72, 0x6c, 0x69, 0x62, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x43, 0x6f, 0x6c, 0x6c,
-	0x65, 0x63, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x48, 0x0a, 0x0a, 0x44,
-	0x6f, 0x63, 0x52, 0x65, 0x63, 0x79, 0x63, 0x6c, 0x65, 0x12, 0x1c, 0x2e, 0x75, 0x73, 0x65, 0x72,
-	0x6c, 0x69, 0x62, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79,
-	0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x6c, 0x69,
-	0x62, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x52, 0x65, 0x73,
-	0x70, 0x6f, 0x6e, 0x73, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
+	0x65, 0x72, 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
+	0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
 }
 
 var (
@@ -900,27 +821,27 @@ var file_userlib_proto_goTypes = []interface{}{
 	(*UserRecoveryRequest)(nil), // 11: userlib.UserRecoveryRequest
 }
 var file_userlib_proto_depIdxs = []int32{
-	0,  // 0: userlib.UserCollectRequest.docCategory:type_name -> userlib.UserDocCategory
-	1,  // 1: userlib.UserCollectRequest.docFileType:type_name -> userlib.UserDocFileType
-	0,  // 2: userlib.UserDocsRequest.userDocCategory:type_name -> userlib.UserDocCategory
-	2,  // 3: userlib.UserRecoveryRequest.userDocStatus:type_name -> userlib.UserDocStatus
-	9,  // 4: userlib.UserLib.UserDocs:input_type -> userlib.UserDocsRequest
-	3,  // 5: userlib.UserLib.DocCollect:input_type -> userlib.UserCollectRequest
-	5,  // 6: userlib.UserLib.DocDelete:input_type -> userlib.UserDeleteRequest
-	7,  // 7: userlib.UserLib.DocRestore:input_type -> userlib.UserRestoreRequest
-	3,  // 8: userlib.UserLib.DocDownload:input_type -> userlib.UserCollectRequest
-	11, // 9: userlib.UserLib.DocRecycle:input_type -> userlib.UserRecoveryRequest
-	10, // 10: userlib.UserLib.UserDocs:output_type -> userlib.UserDocsResponse
-	4,  // 11: userlib.UserLib.DocCollect:output_type -> userlib.UserCollectResponse
+	0,  // 0: userlib.UserDocsRequest.userDocCategory:type_name -> userlib.UserDocCategory
+	2,  // 1: userlib.UserRecoveryRequest.userDocStatus:type_name -> userlib.UserDocStatus
+	9,  // 2: userlib.UserLib.UserDocs:input_type -> userlib.UserDocsRequest
+	3,  // 3: userlib.UserLib.DocCollect:input_type -> userlib.UserCollectRequest
+	5,  // 4: userlib.UserLib.DocCancelCollect:input_type -> userlib.UserDeleteRequest
+	5,  // 5: userlib.UserLib.DocDelete:input_type -> userlib.UserDeleteRequest
+	7,  // 6: userlib.UserLib.DocRestore:input_type -> userlib.UserRestoreRequest
+	3,  // 7: userlib.UserLib.DocDownload:input_type -> userlib.UserCollectRequest
+	11, // 8: userlib.UserLib.DocRecycle:input_type -> userlib.UserRecoveryRequest
+	10, // 9: userlib.UserLib.UserDocs:output_type -> userlib.UserDocsResponse
+	4,  // 10: userlib.UserLib.DocCollect:output_type -> userlib.UserCollectResponse
+	6,  // 11: userlib.UserLib.DocCancelCollect:output_type -> userlib.UserDeleteResponse
 	6,  // 12: userlib.UserLib.DocDelete:output_type -> userlib.UserDeleteResponse
 	8,  // 13: userlib.UserLib.DocRestore:output_type -> userlib.UserRestoreResponse
 	4,  // 14: userlib.UserLib.DocDownload:output_type -> userlib.UserCollectResponse
 	4,  // 15: userlib.UserLib.DocRecycle:output_type -> userlib.UserCollectResponse
-	10, // [10:16] is the sub-list for method output_type
-	4,  // [4:10] is the sub-list for method input_type
-	4,  // [4:4] is the sub-list for extension type_name
-	4,  // [4:4] is the sub-list for extension extendee
-	0,  // [0:4] is the sub-list for field type_name
+	9,  // [9:16] is the sub-list for method output_type
+	2,  // [2:9] is the sub-list for method input_type
+	2,  // [2:2] is the sub-list for extension type_name
+	2,  // [2:2] is the sub-list for extension extendee
+	0,  // [0:2] is the sub-list for field type_name
 }
 
 func init() { file_userlib_proto_init() }
@@ -1073,6 +994,7 @@ const _ = grpc.SupportPackageIsVersion6
 type UserLibClient interface {
 	UserDocs(ctx context.Context, in *UserDocsRequest, opts ...grpc.CallOption) (*UserDocsResponse, error)
 	DocCollect(ctx context.Context, in *UserCollectRequest, opts ...grpc.CallOption) (*UserCollectResponse, error)
+	DocCancelCollect(ctx context.Context, in *UserDeleteRequest, opts ...grpc.CallOption) (*UserDeleteResponse, error)
 	DocDelete(ctx context.Context, in *UserDeleteRequest, opts ...grpc.CallOption) (*UserDeleteResponse, error)
 	DocRestore(ctx context.Context, in *UserRestoreRequest, opts ...grpc.CallOption) (*UserRestoreResponse, error)
 	DocDownload(ctx context.Context, in *UserCollectRequest, opts ...grpc.CallOption) (*UserCollectResponse, error)
@@ -1105,6 +1027,15 @@ func (c *userLibClient) DocCollect(ctx context.Context, in *UserCollectRequest,
 	return out, nil
 }
 
+func (c *userLibClient) DocCancelCollect(ctx context.Context, in *UserDeleteRequest, opts ...grpc.CallOption) (*UserDeleteResponse, error) {
+	out := new(UserDeleteResponse)
+	err := c.cc.Invoke(ctx, "/userlib.UserLib/DocCancelCollect", in, out, opts...)
+	if err != nil {
+		return nil, err
+	}
+	return out, nil
+}
+
 func (c *userLibClient) DocDelete(ctx context.Context, in *UserDeleteRequest, opts ...grpc.CallOption) (*UserDeleteResponse, error) {
 	out := new(UserDeleteResponse)
 	err := c.cc.Invoke(ctx, "/userlib.UserLib/DocDelete", in, out, opts...)
@@ -1145,6 +1076,7 @@ func (c *userLibClient) DocRecycle(ctx context.Context, in *UserRecoveryRequest,
 type UserLibServer interface {
 	UserDocs(context.Context, *UserDocsRequest) (*UserDocsResponse, error)
 	DocCollect(context.Context, *UserCollectRequest) (*UserCollectResponse, error)
+	DocCancelCollect(context.Context, *UserDeleteRequest) (*UserDeleteResponse, error)
 	DocDelete(context.Context, *UserDeleteRequest) (*UserDeleteResponse, error)
 	DocRestore(context.Context, *UserRestoreRequest) (*UserRestoreResponse, error)
 	DocDownload(context.Context, *UserCollectRequest) (*UserCollectResponse, error)
@@ -1161,6 +1093,9 @@ func (*UnimplementedUserLibServer) UserDocs(context.Context, *UserDocsRequest) (
 func (*UnimplementedUserLibServer) DocCollect(context.Context, *UserCollectRequest) (*UserCollectResponse, error) {
 	return nil, status.Errorf(codes.Unimplemented, "method DocCollect not implemented")
 }
+func (*UnimplementedUserLibServer) DocCancelCollect(context.Context, *UserDeleteRequest) (*UserDeleteResponse, error) {
+	return nil, status.Errorf(codes.Unimplemented, "method DocCancelCollect not implemented")
+}
 func (*UnimplementedUserLibServer) DocDelete(context.Context, *UserDeleteRequest) (*UserDeleteResponse, error) {
 	return nil, status.Errorf(codes.Unimplemented, "method DocDelete not implemented")
 }
@@ -1214,6 +1149,24 @@ func _UserLib_DocCollect_Handler(srv interface{}, ctx context.Context, dec func(
 	return interceptor(ctx, in, info, handler)
 }
 
+func _UserLib_DocCancelCollect_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+	in := new(UserDeleteRequest)
+	if err := dec(in); err != nil {
+		return nil, err
+	}
+	if interceptor == nil {
+		return srv.(UserLibServer).DocCancelCollect(ctx, in)
+	}
+	info := &grpc.UnaryServerInfo{
+		Server:     srv,
+		FullMethod: "/userlib.UserLib/DocCancelCollect",
+	}
+	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+		return srv.(UserLibServer).DocCancelCollect(ctx, req.(*UserDeleteRequest))
+	}
+	return interceptor(ctx, in, info, handler)
+}
+
 func _UserLib_DocDelete_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
 	in := new(UserDeleteRequest)
 	if err := dec(in); err != nil {
@@ -1298,6 +1251,10 @@ var _UserLib_serviceDesc = grpc.ServiceDesc{
 			MethodName: "DocCollect",
 			Handler:    _UserLib_DocCollect_Handler,
 		},
+		{
+			MethodName: "DocCancelCollect",
+			Handler:    _UserLib_DocCancelCollect_Handler,
+		},
 		{
 			MethodName: "DocDelete",
 			Handler:    _UserLib_DocDelete_Handler,

+ 9 - 3
rpc/userlib/userlibclient/userlib.go

@@ -14,19 +14,20 @@ import (
 )
 
 type (
+	UserDeleteResponse  = userlib.UserDeleteResponse
 	UserRestoreRequest  = userlib.UserRestoreRequest
 	UserDocsRequest     = userlib.UserDocsRequest
+	UserDocsResponse    = userlib.UserDocsResponse
+	UserRecoveryRequest = userlib.UserRecoveryRequest
 	UserCollectRequest  = userlib.UserCollectRequest
 	UserCollectResponse = userlib.UserCollectResponse
 	UserDeleteRequest   = userlib.UserDeleteRequest
-	UserRecoveryRequest = userlib.UserRecoveryRequest
-	UserDeleteResponse  = userlib.UserDeleteResponse
 	UserRestoreResponse = userlib.UserRestoreResponse
-	UserDocsResponse    = userlib.UserDocsResponse
 
 	UserLib interface {
 		UserDocs(ctx context.Context, in *UserDocsRequest) (*UserDocsResponse, error)
 		DocCollect(ctx context.Context, in *UserCollectRequest) (*UserCollectResponse, error)
+		DocCancelCollect(ctx context.Context, in *UserDeleteRequest) (*UserDeleteResponse, error)
 		DocDelete(ctx context.Context, in *UserDeleteRequest) (*UserDeleteResponse, error)
 		DocRestore(ctx context.Context, in *UserRestoreRequest) (*UserRestoreResponse, error)
 		DocDownload(ctx context.Context, in *UserCollectRequest) (*UserCollectResponse, error)
@@ -54,6 +55,11 @@ func (m *defaultUserLib) DocCollect(ctx context.Context, in *UserCollectRequest)
 	return client.DocCollect(ctx, in)
 }
 
+func (m *defaultUserLib) DocCancelCollect(ctx context.Context, in *UserDeleteRequest) (*UserDeleteResponse, error) {
+	client := userlib.NewUserLibClient(m.cli.Conn())
+	return client.DocCancelCollect(ctx, in)
+}
+
 func (m *defaultUserLib) DocDelete(ctx context.Context, in *UserDeleteRequest) (*UserDeleteResponse, error) {
 	client := userlib.NewUserLibClient(m.cli.Conn())
 	return client.DocDelete(ctx, in)

+ 22 - 26
services/model/stdlib.go

@@ -5,31 +5,28 @@ import (
 )
 
 type Doc struct {
-	Id               string    `json:"id"`
-	UserId           string    `json:"userId"`
-	DocName          string    `json:"before"`
-	DocFileType      int       `json:"docFileType"`
-	DocFileSuffix    string    `json:"docFileSuffix"`
-	DocFileSize      int       `json:"docFileSize"`
-	DocPageSize      int       `json:"docPageSize"`
-	DocTags          string    `json:"docTags"`
-	DocClassLevelOne string    `json:"docClassLevelOne"`
-	DocClassLevelTwo string    `json:"docClassLevelTwo"`
-	UploadDate       string    `json:"uploadDate"`
-	IsDelete         int       `json:"isDelete"`
-	OssDocId         string    `json:"ossDocId"`
-	OssDocUrl        string    `json:"ossDocUrl"`
-	Md5              string    `json:"md5"`
-	OssPdfId         string    `json:"ossPdfId"`
-	OssPdfUrl        string    `json:"ossPdfUrl"`
-	OssTxtId         string    `json:"ossTxtId"`
-	OssTxtUrl        string    `json:"ossTxtUrl"`
-	Price            int       `json:"price"`
-	DownOrUp         int       `json:"downOrUp"`
-	DocSummary       string    `json:"docSummary"`
-	CreateAt         time.Time `json:"-" gorm:"autoCreateTime"` //标签autoCreateTime设置如果字段名字不为CreatAt时候自动插入当前时间
-	UpdateAt         time.Time `json:"-" gorm:"autoUpdateTime"`
-	DeletedAt        time.Time `json:"-" gorm:"column:delete_at"`
+	Id               string    `json:"id" gorm:"id"`
+	UserId           string    `json:"userId" gorm:"column:userId"`
+	DocName          string    `json:"docName" gorm:"column:docName"`
+	DocFileType      int       `json:"docFileType" gorm:"column:docFileType"`
+	DocFileSuffix    string    `json:"docFileSuffix" gorm:"column:docFileSuffix"`
+	DocFileSize      int       `json:"docFileSize" gorm:"column:docFileSize"`
+	DocPageSize      int       `json:"docPageSize" gorm:"column:docPageSize"`
+	DocTags          string    `json:"docTags" gorm:"column:docTags"`
+	DocClassLevelOne string    `json:"docClassLevelOne" gorm:"column:docClassLevelOne"`
+	DocClassLevelTwo string    `json:"docClassLevelTwo" gorm:"column:docClassLevelTwo"`
+	UploadDate       string    `json:"uploadDate" gorm:"column:uploadDate"`
+	IsDelete         int       `json:"isDelete" gorm:"column:isDelete"`
+	OssDocId         string    `json:"ossDocId" gorm:"column:ossDocId"`
+	OssDocUrl        string    `json:"ossDocUrl" gorm:"column:ossDocUrl"`
+	Md5              string    `json:"md5" gorm:"column:md5"`
+	OssPdfId         string    `json:"ossPdfId" gorm:"column:ossPdfId"`
+	OssPdfUrl        string    `json:"ossPdfUrl" gorm:"column:ossPdfUrl"`
+	OssTxtId         string    `json:"ossTxtId" gorm:"column:ossTxtId"`
+	OssTxtUrl        string    `json:"ossTxtUrl" gorm:"column:ossTxtUrl"`
+	Price            int       `json:"price" gorm:"column:price"`
+	DownOrUp         int       `json:"downOrUp" gorm:"column:downOrUp"`
+	DocSummary       string    `json:"docSummary" gorm:"column:docSummary"`
 }
 func (ud *Doc) TableName() string {
 	return "doc"
@@ -40,7 +37,6 @@ type UserDoc struct {
 	CreateAt        time.Time `json:"create_at" gorm:"create_at"` //标签autoCreateTime设置如果字段名字不为CreatAt时候自动插入当前时间
 	UpdateAt        time.Time `json:"update_at" gorm:"update_at"`
 	DeletedAt       time.Time `json:"delete_at" gorm:"column:delete_at"`
-	Id              string    `json:"id"  gorm:"column:id"`
 	UserId          string    `json:"user_id"  gorm:"column:userId"`
 	DocId           string    `json:"doc_id" gorm:"column:docId"`
 	DocCategory     int       `json:"doc_category" gorm:"column:docCategory"`

+ 40 - 2
services/userlib/userDocService.go

@@ -3,6 +3,7 @@ package userlib
 import (
 	"app.yhyue.com/moapp/jyPoints/rpc/integral"
 	"app.yhyue.com/moapp/jyPoints/rpc/integralclient"
+	"app.yhyue.com/moapp/jy_docs/rpc/userlib/userlib"
 	"app.yhyue.com/moapp/jy_docs/services/model"
 	docRpcUtil "app.yhyue.com/moapp/jy_docs/services/util"
 	"context"
@@ -48,7 +49,27 @@ func UserDocCollect(userDoc *model.UserDoc, cost int) bool {
 			//无收藏记录,新增收藏
 		}else{
 			//用户文库表添加记录(需要检查是否重复)
-			err := docRpcUtil.GetJyDocsDB().Create(userDoc).Error
+			timeData := time.Now()
+			userDoc.CreateAt = timeData
+			userDoc.UpdateAt = timeData
+			userDoc.DeletedAt = timeData
+			//查询文档基础信息
+			doc := model.Doc{}
+			err0 := orm.Where("id = ?",userDoc.DocId).
+				Find(&doc)
+			if err0.Error != nil {
+				log.Println("文档不存在",err0)
+				return nil
+			}
+			userDoc.DocSourceUserId = doc.UserId
+			userDoc.DocCategory = doc.DocFileType
+			userDoc.IsDelete = int(userlib.UserDocStatus_Normal)
+			userDoc.DocName = doc.DocName
+			userDoc.DocFileSuffix = doc.DocFileSuffix
+			userDoc.DocFileSize = doc.DocFileSize
+			userDoc.DocPageSize = doc.DocPageSize
+			userDoc.DocSummary = doc.DocSummary
+			err := orm.Create(userDoc).Error
 			if err != nil {
 				log.Println("userDocCollect error:", err)
 				tx.Rollback()
@@ -56,7 +77,7 @@ func UserDocCollect(userDoc *model.UserDoc, cost int) bool {
 			}
 		}
 		//用户收藏、转存记录表添加记录
-		err := docRpcUtil.GetJyDocsDB().Exec("insert into download_collection_record (docId,userId,sourceUserId,category,cost) values (?,?,?,?,?)", userDoc.DocId, userDoc.UserId, userDoc.DocSourceUserId, userDoc.DocCategory, cost).Error
+		err := orm.Exec("insert into download_collection_record (docId,userId,sourceUserId,category,cost) values (?,?,?,?,?)", userDoc.DocId, userDoc.UserId, userDoc.DocSourceUserId, userDoc.DocCategory, cost).Error
 		if err != nil {
 			log.Println("userDocCollect record insert error:", err)
 			tx.Rollback()
@@ -153,6 +174,23 @@ 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().
+				Where("id = ?",userDoc.DocId).
+				Find(&doc)
+			if err0 != nil {
+				log.Println("文档不存在")
+				return nil
+			}
+			userDoc.DocSourceUserId = doc.UserId
+			userDoc.DocCategory = doc.DocFileType
+			userDoc.IsDelete = int(userlib.UserDocStatus_Normal)
+			userDoc.DocName = doc.DocName
+			userDoc.DocFileSuffix = doc.DocFileSuffix
+			userDoc.DocFileSize = doc.DocFileSize
+			userDoc.DocPageSize = doc.DocPageSize
+			userDoc.DocSummary = doc.DocSummary
 			err = docRpcUtil.GetJyDocsDB().Create(userDoc)
 			if err.Error != nil {
 				log.Println("userDocCollect error:", err)