Browse Source

用户库添加用户文档列表查看接口

wanghuidong 4 years ago
parent
commit
fc00232978

+ 1 - 1
rpc/userlib/README.md

@@ -1,6 +1,6 @@
 #用户库
 ###go-zero goctl生基本目录结构脚本命令
-goctl rpc proto -src test.proto -dir .
+goctl rpc proto -src userlib.proto -dir .
 ##DocCollect 用户收藏接口
 ##DocDelete  用户文档删除接口
 ##DocRestore 用户文档恢复接口

+ 2 - 2
rpc/userlib/etc/userlib.yaml

@@ -1,9 +1,9 @@
-Name: userlib.rpc
+Name: jydocs.userlib.rpc
 ListenOn: 127.0.0.1:8081
 Etcd:
   Hosts:
     - 192.168.3.240:2379
-  Key: userlib.rpc
+  Key: jydocs.userlib.rpc
 JyDocsMysqlDB:
   DriverName: "mysql"
   DataSourceName: "root:Topnet123@tcp(192.168.3.11:3366)/jydocs?charset=utf8mb4&parseTime=true&loc=Local"

+ 6 - 2
rpc/userlib/internal/logic/doccollectlogic.go

@@ -6,6 +6,7 @@ import (
 	"app.yhyue.com/moapp/jydocs/rpc/userlib/internal/svc"
 	"app.yhyue.com/moapp/jydocs/rpc/userlib/userlib"
 
+	userLibService "app.yhyue.com/moapp/jydocs/services/userlib"
 	"github.com/tal-tech/go-zero/core/logx"
 )
 
@@ -25,6 +26,9 @@ 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
-
-	return &userlib.UserCollectResponse{}, nil
+	userLibService.UserDocCollect(in.UserId, in.DocId, in.SourceUserId)
+	return &userlib.UserCollectResponse{
+		Code:200,
+		Message:"success",
+	}, nil
 }

+ 30 - 0
rpc/userlib/internal/logic/userdocslogic.go

@@ -0,0 +1,30 @@
+package logic
+
+import (
+	"context"
+
+	"app.yhyue.com/moapp/jydocs/rpc/userlib/internal/svc"
+	"app.yhyue.com/moapp/jydocs/rpc/userlib/userlib"
+
+	"github.com/tal-tech/go-zero/core/logx"
+)
+
+type UserDocsLogic struct {
+	ctx    context.Context
+	svcCtx *svc.ServiceContext
+	logx.Logger
+}
+
+func NewUserDocsLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UserDocsLogic {
+	return &UserDocsLogic{
+		ctx:    ctx,
+		svcCtx: svcCtx,
+		Logger: logx.WithContext(ctx),
+	}
+}
+
+func (l *UserDocsLogic) UserDocs(in *userlib.UserDocsRequest) (*userlib.UserDocsResponse, error) {
+	// todo: add your logic here and delete this line
+
+	return &userlib.UserDocsResponse{}, nil
+}

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

@@ -21,6 +21,11 @@ func NewUserLibServer(svcCtx *svc.ServiceContext) *UserLibServer {
 	}
 }
 
+func (s *UserLibServer) UserDocs(ctx context.Context, in *userlib.UserDocsRequest) (*userlib.UserDocsResponse, error) {
+	l := logic.NewUserDocsLogic(ctx, s.svcCtx)
+	return l.UserDocs(in)
+}
+
 func (s *UserLibServer) DocCollect(ctx context.Context, in *userlib.UserCollectRequest) (*userlib.UserCollectResponse, error) {
 	l := logic.NewDocCollectLogic(ctx, s.svcCtx)
 	return l.DocCollect(in)

+ 31 - 0
rpc/userlib/test/userLib_test.go

@@ -0,0 +1,31 @@
+package test
+
+import (
+	"app.yhyue.com/moapp/jydocs/rpc/userlib/userlibclient"
+	"context"
+	"github.com/tal-tech/go-zero/core/discov"
+	"github.com/tal-tech/go-zero/zrpc"
+	"log"
+	"testing"
+)
+
+
+//用户收藏单元测试
+func Test_UserDocCollect(t *testing.T) {
+	client := zrpc.MustNewClient(zrpc.RpcClientConf{
+		Etcd: discov.EtcdConf{
+			Hosts: []string{"192.168.3.240:2379"},
+			Key:   "jydocs.userlib.rpc",
+		},
+	})
+	userLib := userlibclient.NewUserLib(client)
+	resp, err := userLib.DocCollect(context.Background(), &userlibclient.UserCollectRequest{
+		DocId:        "1",
+		UserId:       "1",
+		SourceUserId: "2",
+	})
+	if err != nil {
+		log.Println("UserDoc Collect call error:", err)
+	}
+	log.Print("UserDoc Collect call response:", resp)
+}

+ 20 - 1
rpc/userlib/userlib.proto

@@ -60,7 +60,26 @@ message UserRestoreResponse {
     string message=2; //响应消息
 }
 
-service  UserLib{
+//用户文档列表
+message UserDocsRequest {
+    string userId=1;//用户id
+    UserDocCategory userDocCategory=2;//用户文档分类
+}
+
+message UserDocsResponse {
+    int32 code =1;    //响应代码
+    string message=2; //响应消息
+    repeated UserDoc docs=3;//用户文档列表
+}
+message UserDoc {
+    string userId=1;
+    string docId=2;
+    string docName=3;
+}
+
+
+service  UserLib {
+    rpc UserDocs(UserDocsRequest) returns (UserDocsResponse);//用户文档列表
   	rpc DocCollect(UserCollectRequest) returns(UserCollectResponse); //文档收藏
 	rpc DocDelete(UserDeleteRequest) returns(UserDeleteResponse); //文档删除
 	rpc DocRestore(UserRestoreRequest) returns(UserRestoreResponse); //文档恢复

+ 326 - 42
rpc/userlib/userlib/userlib.pb.go

@@ -560,6 +560,188 @@ func (x *UserRestoreResponse) GetMessage() string {
 	return ""
 }
 
+//用户文档列表
+type UserDocsRequest struct {
+	state         protoimpl.MessageState
+	sizeCache     protoimpl.SizeCache
+	unknownFields protoimpl.UnknownFields
+
+	UserId          string          `protobuf:"bytes,1,opt,name=userId,proto3" json:"userId,omitempty"`                                                 //用户id
+	UserDocCategory UserDocCategory `protobuf:"varint,2,opt,name=userDocCategory,proto3,enum=userlib.UserDocCategory" json:"userDocCategory,omitempty"` //用户文档分类
+}
+
+func (x *UserDocsRequest) Reset() {
+	*x = UserDocsRequest{}
+	if protoimpl.UnsafeEnabled {
+		mi := &file_userlib_proto_msgTypes[6]
+		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+		ms.StoreMessageInfo(mi)
+	}
+}
+
+func (x *UserDocsRequest) String() string {
+	return protoimpl.X.MessageStringOf(x)
+}
+
+func (*UserDocsRequest) ProtoMessage() {}
+
+func (x *UserDocsRequest) ProtoReflect() protoreflect.Message {
+	mi := &file_userlib_proto_msgTypes[6]
+	if protoimpl.UnsafeEnabled && x != nil {
+		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+		if ms.LoadMessageInfo() == nil {
+			ms.StoreMessageInfo(mi)
+		}
+		return ms
+	}
+	return mi.MessageOf(x)
+}
+
+// Deprecated: Use UserDocsRequest.ProtoReflect.Descriptor instead.
+func (*UserDocsRequest) Descriptor() ([]byte, []int) {
+	return file_userlib_proto_rawDescGZIP(), []int{6}
+}
+
+func (x *UserDocsRequest) GetUserId() string {
+	if x != nil {
+		return x.UserId
+	}
+	return ""
+}
+
+func (x *UserDocsRequest) GetUserDocCategory() UserDocCategory {
+	if x != nil {
+		return x.UserDocCategory
+	}
+	return UserDocCategory_SelfUpload
+}
+
+type UserDocsResponse struct {
+	state         protoimpl.MessageState
+	sizeCache     protoimpl.SizeCache
+	unknownFields protoimpl.UnknownFields
+
+	Code    int32      `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty"`      //响应代码
+	Message string     `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"` //响应消息
+	Docs    []*UserDoc `protobuf:"bytes,3,rep,name=docs,proto3" json:"docs,omitempty"`       //用户文档列表
+}
+
+func (x *UserDocsResponse) Reset() {
+	*x = UserDocsResponse{}
+	if protoimpl.UnsafeEnabled {
+		mi := &file_userlib_proto_msgTypes[7]
+		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+		ms.StoreMessageInfo(mi)
+	}
+}
+
+func (x *UserDocsResponse) String() string {
+	return protoimpl.X.MessageStringOf(x)
+}
+
+func (*UserDocsResponse) ProtoMessage() {}
+
+func (x *UserDocsResponse) ProtoReflect() protoreflect.Message {
+	mi := &file_userlib_proto_msgTypes[7]
+	if protoimpl.UnsafeEnabled && x != nil {
+		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+		if ms.LoadMessageInfo() == nil {
+			ms.StoreMessageInfo(mi)
+		}
+		return ms
+	}
+	return mi.MessageOf(x)
+}
+
+// Deprecated: Use UserDocsResponse.ProtoReflect.Descriptor instead.
+func (*UserDocsResponse) Descriptor() ([]byte, []int) {
+	return file_userlib_proto_rawDescGZIP(), []int{7}
+}
+
+func (x *UserDocsResponse) GetCode() int32 {
+	if x != nil {
+		return x.Code
+	}
+	return 0
+}
+
+func (x *UserDocsResponse) GetMessage() string {
+	if x != nil {
+		return x.Message
+	}
+	return ""
+}
+
+func (x *UserDocsResponse) GetDocs() []*UserDoc {
+	if x != nil {
+		return x.Docs
+	}
+	return nil
+}
+
+type UserDoc struct {
+	state         protoimpl.MessageState
+	sizeCache     protoimpl.SizeCache
+	unknownFields protoimpl.UnknownFields
+
+	UserId  string `protobuf:"bytes,1,opt,name=userId,proto3" json:"userId,omitempty"`
+	DocId   string `protobuf:"bytes,2,opt,name=docId,proto3" json:"docId,omitempty"`
+	DocName string `protobuf:"bytes,3,opt,name=docName,proto3" json:"docName,omitempty"`
+}
+
+func (x *UserDoc) Reset() {
+	*x = UserDoc{}
+	if protoimpl.UnsafeEnabled {
+		mi := &file_userlib_proto_msgTypes[8]
+		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+		ms.StoreMessageInfo(mi)
+	}
+}
+
+func (x *UserDoc) String() string {
+	return protoimpl.X.MessageStringOf(x)
+}
+
+func (*UserDoc) ProtoMessage() {}
+
+func (x *UserDoc) ProtoReflect() protoreflect.Message {
+	mi := &file_userlib_proto_msgTypes[8]
+	if protoimpl.UnsafeEnabled && x != nil {
+		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+		if ms.LoadMessageInfo() == nil {
+			ms.StoreMessageInfo(mi)
+		}
+		return ms
+	}
+	return mi.MessageOf(x)
+}
+
+// Deprecated: Use UserDoc.ProtoReflect.Descriptor instead.
+func (*UserDoc) Descriptor() ([]byte, []int) {
+	return file_userlib_proto_rawDescGZIP(), []int{8}
+}
+
+func (x *UserDoc) GetUserId() string {
+	if x != nil {
+		return x.UserId
+	}
+	return ""
+}
+
+func (x *UserDoc) GetDocId() string {
+	if x != nil {
+		return x.DocId
+	}
+	return ""
+}
+
+func (x *UserDoc) GetDocName() string {
+	if x != nil {
+		return x.DocName
+	}
+	return ""
+}
+
 var File_userlib_proto protoreflect.FileDescriptor
 
 var file_userlib_proto_rawDesc = []byte{
@@ -601,35 +783,58 @@ var file_userlib_proto_rawDesc = []byte{
 	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, 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, 0xe1, 0x01, 0x0a, 0x07, 0x55,
-	0x73, 0x65, 0x72, 0x4c, 0x69, 0x62, 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,
+	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 (
@@ -645,7 +850,7 @@ func file_userlib_proto_rawDescGZIP() []byte {
 }
 
 var file_userlib_proto_enumTypes = make([]protoimpl.EnumInfo, 3)
-var file_userlib_proto_msgTypes = make([]protoimpl.MessageInfo, 6)
+var file_userlib_proto_msgTypes = make([]protoimpl.MessageInfo, 9)
 var file_userlib_proto_goTypes = []interface{}{
 	(UserDocCategory)(0),        // 0: userlib.UserDocCategory
 	(UserDocFileType)(0),        // 1: userlib.UserDocFileType
@@ -656,19 +861,26 @@ var file_userlib_proto_goTypes = []interface{}{
 	(*UserDeleteResponse)(nil),  // 6: userlib.UserDeleteResponse
 	(*UserRestoreRequest)(nil),  // 7: userlib.UserRestoreRequest
 	(*UserRestoreResponse)(nil), // 8: userlib.UserRestoreResponse
+	(*UserDocsRequest)(nil),     // 9: userlib.UserDocsRequest
+	(*UserDocsResponse)(nil),    // 10: userlib.UserDocsResponse
+	(*UserDoc)(nil),             // 11: userlib.UserDoc
 }
 var file_userlib_proto_depIdxs = []int32{
-	3, // 0: userlib.UserLib.DocCollect:input_type -> userlib.UserCollectRequest
-	5, // 1: userlib.UserLib.DocDelete:input_type -> userlib.UserDeleteRequest
-	7, // 2: userlib.UserLib.DocRestore:input_type -> userlib.UserRestoreRequest
-	4, // 3: userlib.UserLib.DocCollect:output_type -> userlib.UserCollectResponse
-	6, // 4: userlib.UserLib.DocDelete:output_type -> userlib.UserDeleteResponse
-	8, // 5: userlib.UserLib.DocRestore:output_type -> userlib.UserRestoreResponse
-	3, // [3:6] is the sub-list for method output_type
-	0, // [0:3] is the sub-list for method input_type
-	0, // [0:0] is the sub-list for extension type_name
-	0, // [0:0] is the sub-list for extension extendee
-	0, // [0:0] is the sub-list for field type_name
+	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
 }
 
 func init() { file_userlib_proto_init() }
@@ -749,6 +961,42 @@ func file_userlib_proto_init() {
 				return nil
 			}
 		}
+		file_userlib_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
+			switch v := v.(*UserDocsRequest); i {
+			case 0:
+				return &v.state
+			case 1:
+				return &v.sizeCache
+			case 2:
+				return &v.unknownFields
+			default:
+				return nil
+			}
+		}
+		file_userlib_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {
+			switch v := v.(*UserDocsResponse); i {
+			case 0:
+				return &v.state
+			case 1:
+				return &v.sizeCache
+			case 2:
+				return &v.unknownFields
+			default:
+				return nil
+			}
+		}
+		file_userlib_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} {
+			switch v := v.(*UserDoc); i {
+			case 0:
+				return &v.state
+			case 1:
+				return &v.sizeCache
+			case 2:
+				return &v.unknownFields
+			default:
+				return nil
+			}
+		}
 	}
 	type x struct{}
 	out := protoimpl.TypeBuilder{
@@ -756,7 +1004,7 @@ func file_userlib_proto_init() {
 			GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
 			RawDescriptor: file_userlib_proto_rawDesc,
 			NumEnums:      3,
-			NumMessages:   6,
+			NumMessages:   9,
 			NumExtensions: 0,
 			NumServices:   1,
 		},
@@ -783,6 +1031,7 @@ const _ = grpc.SupportPackageIsVersion6
 //
 // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
 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)
 	DocDelete(ctx context.Context, in *UserDeleteRequest, opts ...grpc.CallOption) (*UserDeleteResponse, error)
 	DocRestore(ctx context.Context, in *UserRestoreRequest, opts ...grpc.CallOption) (*UserRestoreResponse, error)
@@ -796,6 +1045,15 @@ func NewUserLibClient(cc grpc.ClientConnInterface) UserLibClient {
 	return &userLibClient{cc}
 }
 
+func (c *userLibClient) UserDocs(ctx context.Context, in *UserDocsRequest, opts ...grpc.CallOption) (*UserDocsResponse, error) {
+	out := new(UserDocsResponse)
+	err := c.cc.Invoke(ctx, "/userlib.UserLib/UserDocs", in, out, opts...)
+	if err != nil {
+		return nil, err
+	}
+	return out, nil
+}
+
 func (c *userLibClient) DocCollect(ctx context.Context, in *UserCollectRequest, opts ...grpc.CallOption) (*UserCollectResponse, error) {
 	out := new(UserCollectResponse)
 	err := c.cc.Invoke(ctx, "/userlib.UserLib/DocCollect", in, out, opts...)
@@ -825,6 +1083,7 @@ func (c *userLibClient) DocRestore(ctx context.Context, in *UserRestoreRequest,
 
 // UserLibServer is the server API for UserLib service.
 type UserLibServer interface {
+	UserDocs(context.Context, *UserDocsRequest) (*UserDocsResponse, error)
 	DocCollect(context.Context, *UserCollectRequest) (*UserCollectResponse, error)
 	DocDelete(context.Context, *UserDeleteRequest) (*UserDeleteResponse, error)
 	DocRestore(context.Context, *UserRestoreRequest) (*UserRestoreResponse, error)
@@ -834,6 +1093,9 @@ type UserLibServer interface {
 type UnimplementedUserLibServer struct {
 }
 
+func (*UnimplementedUserLibServer) UserDocs(context.Context, *UserDocsRequest) (*UserDocsResponse, error) {
+	return nil, status.Errorf(codes.Unimplemented, "method UserDocs not implemented")
+}
 func (*UnimplementedUserLibServer) DocCollect(context.Context, *UserCollectRequest) (*UserCollectResponse, error) {
 	return nil, status.Errorf(codes.Unimplemented, "method DocCollect not implemented")
 }
@@ -848,6 +1110,24 @@ func RegisterUserLibServer(s *grpc.Server, srv UserLibServer) {
 	s.RegisterService(&_UserLib_serviceDesc, srv)
 }
 
+func _UserLib_UserDocs_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+	in := new(UserDocsRequest)
+	if err := dec(in); err != nil {
+		return nil, err
+	}
+	if interceptor == nil {
+		return srv.(UserLibServer).UserDocs(ctx, in)
+	}
+	info := &grpc.UnaryServerInfo{
+		Server:     srv,
+		FullMethod: "/userlib.UserLib/UserDocs",
+	}
+	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+		return srv.(UserLibServer).UserDocs(ctx, req.(*UserDocsRequest))
+	}
+	return interceptor(ctx, in, info, handler)
+}
+
 func _UserLib_DocCollect_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
 	in := new(UserCollectRequest)
 	if err := dec(in); err != nil {
@@ -906,6 +1186,10 @@ var _UserLib_serviceDesc = grpc.ServiceDesc{
 	ServiceName: "userlib.UserLib",
 	HandlerType: (*UserLibServer)(nil),
 	Methods: []grpc.MethodDesc{
+		{
+			MethodName: "UserDocs",
+			Handler:    _UserLib_UserDocs_Handler,
+		},
 		{
 			MethodName: "DocCollect",
 			Handler:    _UserLib_DocCollect_Handler,

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

@@ -14,14 +14,18 @@ import (
 )
 
 type (
-	UserRestoreRequest  = userlib.UserRestoreRequest
-	UserRestoreResponse = userlib.UserRestoreResponse
-	UserCollectRequest  = userlib.UserCollectRequest
 	UserCollectResponse = userlib.UserCollectResponse
 	UserDeleteRequest   = userlib.UserDeleteRequest
 	UserDeleteResponse  = userlib.UserDeleteResponse
+	UserRestoreRequest  = userlib.UserRestoreRequest
+	UserRestoreResponse = userlib.UserRestoreResponse
+	UserDocsRequest     = userlib.UserDocsRequest
+	UserDocsResponse    = userlib.UserDocsResponse
+	UserCollectRequest  = userlib.UserCollectRequest
+	UserDoc             = userlib.UserDoc
 
 	UserLib interface {
+		UserDocs(ctx context.Context, in *UserDocsRequest) (*UserDocsResponse, error)
 		DocCollect(ctx context.Context, in *UserCollectRequest) (*UserCollectResponse, error)
 		DocDelete(ctx context.Context, in *UserDeleteRequest) (*UserDeleteResponse, error)
 		DocRestore(ctx context.Context, in *UserRestoreRequest) (*UserRestoreResponse, error)
@@ -38,6 +42,11 @@ func NewUserLib(cli zrpc.Client) UserLib {
 	}
 }
 
+func (m *defaultUserLib) UserDocs(ctx context.Context, in *UserDocsRequest) (*UserDocsResponse, error) {
+	client := userlib.NewUserLibClient(m.cli.Conn())
+	return client.UserDocs(ctx, in)
+}
+
 func (m *defaultUserLib) DocCollect(ctx context.Context, in *UserCollectRequest) (*UserCollectResponse, error) {
 	client := userlib.NewUserLibClient(m.cli.Conn())
 	return client.DocCollect(ctx, in)

+ 1 - 0
services/userlib/userDocService.go

@@ -0,0 +1 @@
+package userlib