Browse Source

用户库收藏示例开发提交

wanghuidong 4 years ago
parent
commit
c3d8f3db08

+ 19 - 3
rpc/userlib/internal/logic/doccollectlogic.go

@@ -1,7 +1,9 @@
 package logic
 
 import (
+	"app.yhyue.com/moapp/jydocs/services/model"
 	"context"
+	"log"
 
 	"app.yhyue.com/moapp/jydocs/rpc/userlib/internal/svc"
 	"app.yhyue.com/moapp/jydocs/rpc/userlib/userlib"
@@ -26,9 +28,23 @@ func NewDocCollectLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DocCol
 
 func (l *DocCollectLogic) DocCollect(in *userlib.UserCollectRequest) (*userlib.UserCollectResponse, error) {
 	// todo: add your logic here and delete this line
-	userLibService.UserDocCollect(in.UserId, in.DocId, in.SourceUserId)
+	b := userLibService.UserDocCollect(
+		&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{
-		Code:200,
-		Message:"success",
+		Code:    200,
+		Message: "success",
 	}, nil
 }

+ 8 - 1
rpc/userlib/test/userLib_test.go

@@ -1,6 +1,7 @@
 package test
 
 import (
+	"app.yhyue.com/moapp/jydocs/rpc/userlib/userlib"
 	"app.yhyue.com/moapp/jydocs/rpc/userlib/userlibclient"
 	"context"
 	"github.com/tal-tech/go-zero/core/discov"
@@ -9,7 +10,6 @@ import (
 	"testing"
 )
 
-
 //用户收藏单元测试
 func Test_UserDocCollect(t *testing.T) {
 	client := zrpc.MustNewClient(zrpc.RpcClientConf{
@@ -23,6 +23,13 @@ func Test_UserDocCollect(t *testing.T) {
 		DocId:        "1",
 		UserId:       "1",
 		SourceUserId: "2",
+		DocName:      "2020招标文件白皮书.docx",
+		DocFileType:  userlib.UserDocFileType_Doc,
+		DocFileSize:  1002,
+		DocPageSize:  20,
+		DocCategory:  userlib.UserDocCategory_Collect,
+		DocFileSuffix:"docx",
+		Cost:0,
 	})
 	if err != nil {
 		log.Println("UserDoc Collect call error:", err)

+ 17 - 12
rpc/userlib/userlib.proto

@@ -9,14 +9,17 @@ enum UserDocCategory {
 }
 //文件类型
 enum UserDocFileType {
-    Doc =0;
-    Pdf =1;
-    Xls =2;
-    Ppt =3;
-    Txt =4;
+    Word =0;
+    PDF =1;
+   EXCEL=2;
+    PPT =3;
+    TXT =4;
   Other =5;
 }
 
+
+
+
 enum UserDocStatus {
     Normal =0;//文件正常
     LogicDelete =1;//删除
@@ -24,17 +27,19 @@ enum UserDocStatus {
 }
 
 
-//用户收藏
+//用户收藏|转存
 message UserCollectRequest {
     string userId=1; //用户id
     string docId=2; //文档id
     string sourceUserId=3; //原文档用户id
-    string docName =4;//文档名称
-    int32 docFileType=5;//文档类型
-    string docFileSuffix=6;//文档后缀
-    int32 docFileSize=7;//文档大小
-    int32 docPageSize=8;//页码数目
-    string docSummary=9;//文档摘要
+    UserDocCategory docCategory=4;//文档类别
+    string docName =5;//文档名称
+    UserDocFileType docFileType=6;//文档类型
+    string docFileSuffix=7;//文档后缀
+    int32 docFileSize=8;//文档大小
+    int32 docPageSize=9;//页码数目
+    string docSummary=10;//文档摘要
+    int32 cost=11;//收藏|转存费用
 }
 
 message UserCollectResponse {

+ 134 - 110
rpc/userlib/userlib/userlib.pb.go

@@ -187,21 +187,23 @@ func (UserDocStatus) EnumDescriptor() ([]byte, []int) {
 	return file_userlib_proto_rawDescGZIP(), []int{2}
 }
 
-//用户收藏
+//用户收藏|转存
 type UserCollectRequest struct {
 	state         protoimpl.MessageState
 	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
-	DocName       string `protobuf:"bytes,4,opt,name=docName,proto3" json:"docName,omitempty"`             //文档名称
-	DocFileType   int32  `protobuf:"varint,5,opt,name=docFileType,proto3" json:"docFileType,omitempty"`    //文档类型
-	DocFileSuffix string `protobuf:"bytes,6,opt,name=docFileSuffix,proto3" json:"docFileSuffix,omitempty"` //文档后缀
-	DocFileSize   int32  `protobuf:"varint,7,opt,name=docFileSize,proto3" json:"docFileSize,omitempty"`    //文档大小
-	DocPageSize   int32  `protobuf:"varint,8,opt,name=docPageSize,proto3" json:"docPageSize,omitempty"`    //页码数目
-	DocSummary    string `protobuf:"bytes,9,opt,name=docSummary,proto3" json:"docSummary,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
+	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"`                                           //收藏|转存费用
 }
 
 func (x *UserCollectRequest) Reset() {
@@ -257,6 +259,13 @@ func (x *UserCollectRequest) GetSourceUserId() string {
 	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
@@ -264,11 +273,11 @@ func (x *UserCollectRequest) GetDocName() string {
 	return ""
 }
 
-func (x *UserCollectRequest) GetDocFileType() int32 {
+func (x *UserCollectRequest) GetDocFileType() UserDocFileType {
 	if x != nil {
 		return x.DocFileType
 	}
-	return 0
+	return UserDocFileType_Doc
 }
 
 func (x *UserCollectRequest) GetDocFileSuffix() string {
@@ -299,6 +308,13 @@ func (x *UserCollectRequest) GetDocSummary() string {
 	return ""
 }
 
+func (x *UserCollectRequest) GetCost() int32 {
+	if x != nil {
+		return x.Cost
+	}
+	return 0
+}
+
 type UserCollectResponse struct {
 	state         protoimpl.MessageState
 	sizeCache     protoimpl.SizeCache
@@ -746,95 +762,101 @@ 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, 0xac, 0x02, 0x0a, 0x12, 0x55, 0x73, 0x65,
+	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, 0x18, 0x0a, 0x07, 0x64, 0x6f, 0x63, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01,
-	0x28, 0x09, 0x52, 0x07, 0x64, 0x6f, 0x63, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x64,
-	0x6f, 0x63, 0x46, 0x69, 0x6c, 0x65, 0x54, 0x79, 0x70, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05,
-	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, 0x06,
-	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, 0x07, 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, 0x08, 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, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x64, 0x6f, 0x63,
-	0x53, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 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, 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, 0x66, 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, 0x12, 0x24, 0x0a,
-	0x04, 0x64, 0x6f, 0x63, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x75, 0x73,
-	0x65, 0x72, 0x6c, 0x69, 0x62, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x44, 0x6f, 0x63, 0x52, 0x04, 0x64,
-	0x6f, 0x63, 0x73, 0x22, 0x51, 0x0a, 0x07, 0x55, 0x73, 0x65, 0x72, 0x44, 0x6f, 0x63, 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, 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, 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, 0x49, 0x0a, 0x0f, 0x55, 0x73, 0x65, 0x72, 0x44, 0x6f, 0x63, 0x46,
-	0x69, 0x6c, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x07, 0x0a, 0x03, 0x44, 0x6f, 0x63, 0x10, 0x00,
-	0x12, 0x07, 0x0a, 0x03, 0x50, 0x64, 0x66, 0x10, 0x01, 0x12, 0x07, 0x0a, 0x03, 0x58, 0x6c, 0x73,
-	0x10, 0x02, 0x12, 0x07, 0x0a, 0x03, 0x50, 0x70, 0x74, 0x10, 0x03, 0x12, 0x07, 0x0a, 0x03, 0x54,
-	0x78, 0x74, 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, 0xa2, 0x02, 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, 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, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f,
-	0x33,
+	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,
+	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, 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, 0x66, 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, 0x12, 0x24, 0x0a, 0x04, 0x64, 0x6f, 0x63, 0x73, 0x18,
+	0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x6c, 0x69, 0x62, 0x2e,
+	0x55, 0x73, 0x65, 0x72, 0x44, 0x6f, 0x63, 0x52, 0x04, 0x64, 0x6f, 0x63, 0x73, 0x22, 0x51, 0x0a,
+	0x07, 0x55, 0x73, 0x65, 0x72, 0x44, 0x6f, 0x63, 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, 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,
+	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, 0x49,
+	0x0a, 0x0f, 0x55, 0x73, 0x65, 0x72, 0x44, 0x6f, 0x63, 0x46, 0x69, 0x6c, 0x65, 0x54, 0x79, 0x70,
+	0x65, 0x12, 0x07, 0x0a, 0x03, 0x44, 0x6f, 0x63, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, 0x50, 0x64,
+	0x66, 0x10, 0x01, 0x12, 0x07, 0x0a, 0x03, 0x58, 0x6c, 0x73, 0x10, 0x02, 0x12, 0x07, 0x0a, 0x03,
+	0x50, 0x70, 0x74, 0x10, 0x03, 0x12, 0x07, 0x0a, 0x03, 0x54, 0x78, 0x74, 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, 0xa2,
+	0x02, 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, 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, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
 }
 
 var (
@@ -866,21 +888,23 @@ var file_userlib_proto_goTypes = []interface{}{
 	(*UserDoc)(nil),             // 11: userlib.UserDoc
 }
 var file_userlib_proto_depIdxs = []int32{
-	0,  // 0: userlib.UserDocsRequest.userDocCategory:type_name -> userlib.UserDocCategory
-	11, // 1: userlib.UserDocsResponse.docs:type_name -> userlib.UserDoc
-	9,  // 2: userlib.UserLib.UserDocs:input_type -> userlib.UserDocsRequest
-	3,  // 3: userlib.UserLib.DocCollect:input_type -> userlib.UserCollectRequest
-	5,  // 4: userlib.UserLib.DocDelete:input_type -> userlib.UserDeleteRequest
-	7,  // 5: userlib.UserLib.DocRestore:input_type -> userlib.UserRestoreRequest
-	10, // 6: userlib.UserLib.UserDocs:output_type -> userlib.UserDocsResponse
-	4,  // 7: userlib.UserLib.DocCollect:output_type -> userlib.UserCollectResponse
-	6,  // 8: userlib.UserLib.DocDelete:output_type -> userlib.UserDeleteResponse
-	8,  // 9: userlib.UserLib.DocRestore:output_type -> userlib.UserRestoreResponse
-	6,  // [6:10] is the sub-list for method output_type
-	2,  // [2:6] 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
+	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
+	11, // 3: userlib.UserDocsResponse.docs:type_name -> userlib.UserDoc
+	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
+	10, // 8: userlib.UserLib.UserDocs:output_type -> userlib.UserDocsResponse
+	4,  // 9: userlib.UserLib.DocCollect:output_type -> userlib.UserCollectResponse
+	6,  // 10: userlib.UserLib.DocDelete:output_type -> userlib.UserDeleteResponse
+	8,  // 11: userlib.UserLib.DocRestore:output_type -> userlib.UserRestoreResponse
+	8,  // [8:12] is the sub-list for method output_type
+	4,  // [4:8] 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
 }
 
 func init() { file_userlib_proto_init() }

+ 5 - 5
rpc/userlib/userlibclient/userlib.go

@@ -14,15 +14,15 @@ import (
 )
 
 type (
-	UserCollectResponse = userlib.UserCollectResponse
-	UserDeleteRequest   = userlib.UserDeleteRequest
-	UserDeleteResponse  = userlib.UserDeleteResponse
+	UserDocsRequest     = userlib.UserDocsRequest
+	UserDoc             = userlib.UserDoc
 	UserRestoreRequest  = userlib.UserRestoreRequest
 	UserRestoreResponse = userlib.UserRestoreResponse
-	UserDocsRequest     = userlib.UserDocsRequest
+	UserDeleteRequest   = userlib.UserDeleteRequest
+	UserDeleteResponse  = userlib.UserDeleteResponse
 	UserDocsResponse    = userlib.UserDocsResponse
 	UserCollectRequest  = userlib.UserCollectRequest
-	UserDoc             = userlib.UserDoc
+	UserCollectResponse = userlib.UserCollectResponse
 
 	UserLib interface {
 		UserDocs(ctx context.Context, in *UserDocsRequest) (*UserDocsResponse, error)

+ 13 - 0
services/model/base_model.go

@@ -0,0 +1,13 @@
+package model
+
+import (
+	"gorm.io/gorm"
+	"time"
+)
+
+type BaseModel struct {
+	ID         int            `json:"id" form:"id" gorm:"primaryKey"`
+	CreateAt  time.Time      `json:"-" gorm:"autoCreateTime"` //标签autoCreateTime设置如果字段名字不为CreatAt时候自动插入当前时间
+	UpdateAt  time.Time      `json:"-" gorm:"autoUpdateTime"`
+	DeletedAt gorm.DeletedAt `json:"-" gorm:"column:delete_at"`
+}

+ 19 - 0
services/model/stdlib.go

@@ -24,3 +24,22 @@ type UserMoneyRecord struct {
 	DownOrUp         int    `json:"downOrUp"`
 	DocSummary       string `json:"docSummary"`
 }
+
+type UserDoc struct {
+	BaseModel
+	UserId        string `json:"user_id"  gorm:"column:userId"`
+	DocId         string `json:"doc_id" gorm:"column:docId"`
+	DocCategory   int    `json:"doc_category" gorm:"column:docCategory"`
+	IsDelete      int    `json:"is_delete" gorm:"column:isDelete"`
+	DocName       string `json:"doc_name" gorm:"column:docName"`
+	DocFileType   int    `json:"doc_file_type" gorm:"column:docFileType"`
+	DocFileSuffix string `json:"doc_file_suffix" gorm:"column:docFileSuffix"`
+	DocFileSize   int    `json:"doc_file_size" gorm:"column:docFileSize"`
+	DocPageSize   int    `json:"doc_page_size" gorm:"column:docPageSize"`
+	DocSummary    string `json:"doc_summary" gorm:"column:docSummary"`
+	DocSourceUserId string `json:"doc_source_user_id" gorm:"column:docSourceUserId"`
+}
+
+func (ud *UserDoc) TableName() string {
+	return "user_doc"
+}

+ 32 - 0
services/userlib/userDocService.go

@@ -1 +1,33 @@
 package userlib
+
+import (
+	"app.yhyue.com/moapp/jydocs/services/model"
+	docRpcUtil "app.yhyue.com/moapp/jydocs/services/util"
+	"gorm.io/gorm"
+	"log"
+)
+
+func UserDocCollect(userDoc *model.UserDoc, cost int) bool {
+	log.Println("UserDocCollect exec ......")
+	err := docRpcUtil.GetJyDocsDB().Transaction(func(tx *gorm.DB) error {
+		//用户文库表添加记录(需要检查是否重复)
+		err := docRpcUtil.GetJyDocsDB().Create(userDoc).Error
+		if err != nil {
+			log.Println("userDocCollect error:", err)
+			tx.Rollback()
+			return err
+		}
+		//用户收藏、转存记录表添加记录
+		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
+		if err != nil {
+			log.Println("userDocCollect record insert error:", err)
+			tx.Rollback()
+			return err
+		}
+		return nil
+	})
+	if err != nil {
+		return false
+	}
+	return true
+}