Ver código fonte

用户库协议定义

wanghuidong 4 anos atrás
pai
commit
9e22098e71

+ 3 - 13
rpc/stdlib/internal/config/config.go

@@ -1,22 +1,12 @@
 package config
 
 import "github.com/tal-tech/go-zero/zrpc"
+import jyDocRpcUtil "app.yhyue.com/moapp/jydocs/services/util"
 
 type Config struct {
 	zrpc.RpcServerConf
-	JyDocsMysqlDB MysqlDBConfig
-	EsConfig      EsConfig
+	JyDocsMysqlDB jyDocRpcUtil.MysqlDBConfig
+	EsConfig      jyDocRpcUtil.EsConfig
 }
 
-type MysqlDBConfig struct {
-	DriverName      string
-	DataSourceName  string
-	MaxOpenConn     int
-	MaxIdleConn     int
-	MaxConnLifeTime int
-}
 
-type EsConfig struct {
-	Addr string
-	Pool int
-}

+ 6 - 1
rpc/userlib/README.md

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

+ 12 - 0
rpc/userlib/etc/userlib.yaml

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

+ 11 - 0
rpc/userlib/internal/config/config.go

@@ -0,0 +1,11 @@
+package config
+
+import (
+	jyDocRpcUtil "app.yhyue.com/moapp/jydocs/services/util"
+	"github.com/tal-tech/go-zero/zrpc"
+)
+
+type Config struct {
+	zrpc.RpcServerConf
+	JyDocsMysqlDB jyDocRpcUtil.MysqlDBConfig
+}

+ 30 - 0
rpc/userlib/internal/logic/doccollectlogic.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 DocCollectLogic struct {
+	ctx    context.Context
+	svcCtx *svc.ServiceContext
+	logx.Logger
+}
+
+func NewDocCollectLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DocCollectLogic {
+	return &DocCollectLogic{
+		ctx:    ctx,
+		svcCtx: svcCtx,
+		Logger: logx.WithContext(ctx),
+	}
+}
+
+func (l *DocCollectLogic) DocCollect(in *userlib.UserCollectRequest) (*userlib.UserCollectResponse, error) {
+	// todo: add your logic here and delete this line
+
+	return &userlib.UserCollectResponse{}, nil
+}

+ 30 - 0
rpc/userlib/internal/logic/docdeletelogic.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 DocDeleteLogic struct {
+	ctx    context.Context
+	svcCtx *svc.ServiceContext
+	logx.Logger
+}
+
+func NewDocDeleteLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DocDeleteLogic {
+	return &DocDeleteLogic{
+		ctx:    ctx,
+		svcCtx: svcCtx,
+		Logger: logx.WithContext(ctx),
+	}
+}
+
+func (l *DocDeleteLogic) DocDelete(in *userlib.UserDeleteRequest) (*userlib.UserDeleteResponse, error) {
+	// todo: add your logic here and delete this line
+
+	return &userlib.UserDeleteResponse{}, nil
+}

+ 30 - 0
rpc/userlib/internal/logic/docrestorelogic.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 DocRestoreLogic struct {
+	ctx    context.Context
+	svcCtx *svc.ServiceContext
+	logx.Logger
+}
+
+func NewDocRestoreLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DocRestoreLogic {
+	return &DocRestoreLogic{
+		ctx:    ctx,
+		svcCtx: svcCtx,
+		Logger: logx.WithContext(ctx),
+	}
+}
+
+func (l *DocRestoreLogic) DocRestore(in *userlib.UserRestoreRequest) (*userlib.UserRestoreResponse, error) {
+	// todo: add your logic here and delete this line
+
+	return &userlib.UserRestoreResponse{}, nil
+}

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

@@ -0,0 +1,37 @@
+// Code generated by goctl. DO NOT EDIT!
+// Source: userlib.proto
+
+package server
+
+import (
+	"context"
+
+	"app.yhyue.com/moapp/jydocs/rpc/userlib/internal/logic"
+	"app.yhyue.com/moapp/jydocs/rpc/userlib/internal/svc"
+	"app.yhyue.com/moapp/jydocs/rpc/userlib/userlib"
+)
+
+type UserLibServer struct {
+	svcCtx *svc.ServiceContext
+}
+
+func NewUserLibServer(svcCtx *svc.ServiceContext) *UserLibServer {
+	return &UserLibServer{
+		svcCtx: svcCtx,
+	}
+}
+
+func (s *UserLibServer) DocCollect(ctx context.Context, in *userlib.UserCollectRequest) (*userlib.UserCollectResponse, error) {
+	l := logic.NewDocCollectLogic(ctx, s.svcCtx)
+	return l.DocCollect(in)
+}
+
+func (s *UserLibServer) DocDelete(ctx context.Context, in *userlib.UserDeleteRequest) (*userlib.UserDeleteResponse, error) {
+	l := logic.NewDocDeleteLogic(ctx, s.svcCtx)
+	return l.DocDelete(in)
+}
+
+func (s *UserLibServer) DocRestore(ctx context.Context, in *userlib.UserRestoreRequest) (*userlib.UserRestoreResponse, error) {
+	l := logic.NewDocRestoreLogic(ctx, s.svcCtx)
+	return l.DocRestore(in)
+}

+ 13 - 0
rpc/userlib/internal/svc/servicecontext.go

@@ -0,0 +1,13 @@
+package svc
+
+import "app.yhyue.com/moapp/jydocs/rpc/userlib/internal/config"
+
+type ServiceContext struct {
+	Config config.Config
+}
+
+func NewServiceContext(c config.Config) *ServiceContext {
+	return &ServiceContext{
+		Config: c,
+	}
+}

+ 39 - 0
rpc/userlib/userlib.go

@@ -0,0 +1,39 @@
+package main
+
+import (
+	jyDocsRpcUtil "app.yhyue.com/moapp/jydocs/services/util"
+	"flag"
+	"fmt"
+	"log"
+
+	"app.yhyue.com/moapp/jydocs/rpc/userlib/internal/config"
+	"app.yhyue.com/moapp/jydocs/rpc/userlib/internal/server"
+	"app.yhyue.com/moapp/jydocs/rpc/userlib/internal/svc"
+	"app.yhyue.com/moapp/jydocs/rpc/userlib/userlib"
+
+	"github.com/tal-tech/go-zero/core/conf"
+	"github.com/tal-tech/go-zero/zrpc"
+	"google.golang.org/grpc"
+)
+
+var configFile = flag.String("f", "etc/userlib.yaml", "the config file")
+
+func main() {
+	flag.Parse()
+
+	var c config.Config
+	conf.MustLoad(*configFile, &c)
+	if c.JyDocsMysqlDB.DataSourceName != "" {
+		jyDocsRpcUtil.InitDB(c.JyDocsMysqlDB.DataSourceName, c.JyDocsMysqlDB.DriverName, c.JyDocsMysqlDB.MaxOpenConn, c.JyDocsMysqlDB.MaxIdleConn)
+		ctx := svc.NewServiceContext(c)
+		srv := server.NewUserLibServer(ctx)
+		s := zrpc.MustNewServer(c.RpcServerConf, func(grpcServer *grpc.Server) {
+			userlib.RegisterUserLibServer(grpcServer, srv)
+		})
+		defer s.Stop()
+		fmt.Printf("Starting rpc server at %s...\n", c.ListenOn)
+		s.Start()
+	} else {
+		log.Fatal("【jy_docs】 read config error!")
+	}
+}

+ 67 - 0
rpc/userlib/userlib.proto

@@ -0,0 +1,67 @@
+syntax = "proto3";
+package userlib;
+
+//用户文档类别
+enum UserDocCategory {
+    SelfUpload = 0;//自己上传
+    Download =1;   //转存(下载)
+    Collect  =2;   //收藏
+}
+//文件类型
+enum UserDocFileType {
+    Doc =0;
+    Pdf =1;
+    Xls =2;
+    Ppt =3;
+    Txt =4;
+  Other =5;
+}
+
+enum UserDocStatus {
+    Normal =0;//文件正常
+    LogicDelete =1;//删除
+    PermanentlyDelete =2;//永久删除
+}
+
+
+//用户收藏
+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;//文档摘要
+}
+
+message UserCollectResponse {
+    int32 code =1;    //响应代码
+    string message=2; //响应消息
+}
+
+//用户删除
+message UserDeleteRequest {
+    string docId=1;//文档id
+}
+message UserDeleteResponse {
+    int32 code =1;    //响应代码
+    string message=2; //响应消息
+}
+
+//用户恢复
+message UserRestoreRequest {
+    string docId=1;//文档id
+}
+message UserRestoreResponse {
+    int32 code =1;    //响应代码
+    string message=2; //响应消息
+}
+
+service  UserLib{
+  	rpc DocCollect(UserCollectRequest) returns(UserCollectResponse); //文档收藏
+	rpc DocDelete(UserDeleteRequest) returns(UserDeleteResponse); //文档删除
+	rpc DocRestore(UserRestoreRequest) returns(UserRestoreResponse); //文档恢复
+}

+ 924 - 0
rpc/userlib/userlib/userlib.pb.go

@@ -0,0 +1,924 @@
+// Code generated by protoc-gen-go. DO NOT EDIT.
+// versions:
+// 	protoc-gen-go v1.25.0
+// 	protoc        v3.15.5
+// source: userlib.proto
+
+package userlib
+
+import (
+	context "context"
+	proto "github.com/golang/protobuf/proto"
+	grpc "google.golang.org/grpc"
+	codes "google.golang.org/grpc/codes"
+	status "google.golang.org/grpc/status"
+	protoreflect "google.golang.org/protobuf/reflect/protoreflect"
+	protoimpl "google.golang.org/protobuf/runtime/protoimpl"
+	reflect "reflect"
+	sync "sync"
+)
+
+const (
+	// Verify that this generated code is sufficiently up-to-date.
+	_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
+	// Verify that runtime/protoimpl is sufficiently up-to-date.
+	_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
+)
+
+// This is a compile-time assertion that a sufficiently up-to-date version
+// of the legacy proto package is being used.
+const _ = proto.ProtoPackageIsVersion4
+
+//用户文档类别
+type UserDocCategory int32
+
+const (
+	UserDocCategory_SelfUpload UserDocCategory = 0 //自己上传
+	UserDocCategory_Download   UserDocCategory = 1 //转存(下载)
+	UserDocCategory_Collect    UserDocCategory = 2 //收藏
+)
+
+// Enum value maps for UserDocCategory.
+var (
+	UserDocCategory_name = map[int32]string{
+		0: "SelfUpload",
+		1: "Download",
+		2: "Collect",
+	}
+	UserDocCategory_value = map[string]int32{
+		"SelfUpload": 0,
+		"Download":   1,
+		"Collect":    2,
+	}
+)
+
+func (x UserDocCategory) Enum() *UserDocCategory {
+	p := new(UserDocCategory)
+	*p = x
+	return p
+}
+
+func (x UserDocCategory) String() string {
+	return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
+}
+
+func (UserDocCategory) Descriptor() protoreflect.EnumDescriptor {
+	return file_userlib_proto_enumTypes[0].Descriptor()
+}
+
+func (UserDocCategory) Type() protoreflect.EnumType {
+	return &file_userlib_proto_enumTypes[0]
+}
+
+func (x UserDocCategory) Number() protoreflect.EnumNumber {
+	return protoreflect.EnumNumber(x)
+}
+
+// Deprecated: Use UserDocCategory.Descriptor instead.
+func (UserDocCategory) EnumDescriptor() ([]byte, []int) {
+	return file_userlib_proto_rawDescGZIP(), []int{0}
+}
+
+//文件类型
+type UserDocFileType int32
+
+const (
+	UserDocFileType_Doc   UserDocFileType = 0
+	UserDocFileType_Pdf   UserDocFileType = 1
+	UserDocFileType_Xls   UserDocFileType = 2
+	UserDocFileType_Ppt   UserDocFileType = 3
+	UserDocFileType_Txt   UserDocFileType = 4
+	UserDocFileType_Other UserDocFileType = 5
+)
+
+// Enum value maps for UserDocFileType.
+var (
+	UserDocFileType_name = map[int32]string{
+		0: "Doc",
+		1: "Pdf",
+		2: "Xls",
+		3: "Ppt",
+		4: "Txt",
+		5: "Other",
+	}
+	UserDocFileType_value = map[string]int32{
+		"Doc":   0,
+		"Pdf":   1,
+		"Xls":   2,
+		"Ppt":   3,
+		"Txt":   4,
+		"Other": 5,
+	}
+)
+
+func (x UserDocFileType) Enum() *UserDocFileType {
+	p := new(UserDocFileType)
+	*p = x
+	return p
+}
+
+func (x UserDocFileType) String() string {
+	return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
+}
+
+func (UserDocFileType) Descriptor() protoreflect.EnumDescriptor {
+	return file_userlib_proto_enumTypes[1].Descriptor()
+}
+
+func (UserDocFileType) Type() protoreflect.EnumType {
+	return &file_userlib_proto_enumTypes[1]
+}
+
+func (x UserDocFileType) Number() protoreflect.EnumNumber {
+	return protoreflect.EnumNumber(x)
+}
+
+// Deprecated: Use UserDocFileType.Descriptor instead.
+func (UserDocFileType) EnumDescriptor() ([]byte, []int) {
+	return file_userlib_proto_rawDescGZIP(), []int{1}
+}
+
+type UserDocStatus int32
+
+const (
+	UserDocStatus_Normal            UserDocStatus = 0 //文件正常
+	UserDocStatus_LogicDelete       UserDocStatus = 1 //删除
+	UserDocStatus_PermanentlyDelete UserDocStatus = 2 //永久删除
+)
+
+// Enum value maps for UserDocStatus.
+var (
+	UserDocStatus_name = map[int32]string{
+		0: "Normal",
+		1: "LogicDelete",
+		2: "PermanentlyDelete",
+	}
+	UserDocStatus_value = map[string]int32{
+		"Normal":            0,
+		"LogicDelete":       1,
+		"PermanentlyDelete": 2,
+	}
+)
+
+func (x UserDocStatus) Enum() *UserDocStatus {
+	p := new(UserDocStatus)
+	*p = x
+	return p
+}
+
+func (x UserDocStatus) String() string {
+	return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
+}
+
+func (UserDocStatus) Descriptor() protoreflect.EnumDescriptor {
+	return file_userlib_proto_enumTypes[2].Descriptor()
+}
+
+func (UserDocStatus) Type() protoreflect.EnumType {
+	return &file_userlib_proto_enumTypes[2]
+}
+
+func (x UserDocStatus) Number() protoreflect.EnumNumber {
+	return protoreflect.EnumNumber(x)
+}
+
+// Deprecated: Use UserDocStatus.Descriptor instead.
+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"`       //文档摘要
+}
+
+func (x *UserCollectRequest) Reset() {
+	*x = UserCollectRequest{}
+	if protoimpl.UnsafeEnabled {
+		mi := &file_userlib_proto_msgTypes[0]
+		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+		ms.StoreMessageInfo(mi)
+	}
+}
+
+func (x *UserCollectRequest) String() string {
+	return protoimpl.X.MessageStringOf(x)
+}
+
+func (*UserCollectRequest) ProtoMessage() {}
+
+func (x *UserCollectRequest) ProtoReflect() protoreflect.Message {
+	mi := &file_userlib_proto_msgTypes[0]
+	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 UserCollectRequest.ProtoReflect.Descriptor instead.
+func (*UserCollectRequest) Descriptor() ([]byte, []int) {
+	return file_userlib_proto_rawDescGZIP(), []int{0}
+}
+
+func (x *UserCollectRequest) GetUserId() string {
+	if x != nil {
+		return x.UserId
+	}
+	return ""
+}
+
+func (x *UserCollectRequest) GetDocId() string {
+	if x != nil {
+		return x.DocId
+	}
+	return ""
+}
+
+func (x *UserCollectRequest) GetSourceUserId() string {
+	if x != nil {
+		return x.SourceUserId
+	}
+	return ""
+}
+
+func (x *UserCollectRequest) GetDocName() string {
+	if x != nil {
+		return x.DocName
+	}
+	return ""
+}
+
+func (x *UserCollectRequest) GetDocFileType() int32 {
+	if x != nil {
+		return x.DocFileType
+	}
+	return 0
+}
+
+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 ""
+}
+
+type UserCollectResponse 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"` //响应消息
+}
+
+func (x *UserCollectResponse) Reset() {
+	*x = UserCollectResponse{}
+	if protoimpl.UnsafeEnabled {
+		mi := &file_userlib_proto_msgTypes[1]
+		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+		ms.StoreMessageInfo(mi)
+	}
+}
+
+func (x *UserCollectResponse) String() string {
+	return protoimpl.X.MessageStringOf(x)
+}
+
+func (*UserCollectResponse) ProtoMessage() {}
+
+func (x *UserCollectResponse) ProtoReflect() protoreflect.Message {
+	mi := &file_userlib_proto_msgTypes[1]
+	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 UserCollectResponse.ProtoReflect.Descriptor instead.
+func (*UserCollectResponse) Descriptor() ([]byte, []int) {
+	return file_userlib_proto_rawDescGZIP(), []int{1}
+}
+
+func (x *UserCollectResponse) GetCode() int32 {
+	if x != nil {
+		return x.Code
+	}
+	return 0
+}
+
+func (x *UserCollectResponse) GetMessage() string {
+	if x != nil {
+		return x.Message
+	}
+	return ""
+}
+
+//用户删除
+type UserDeleteRequest struct {
+	state         protoimpl.MessageState
+	sizeCache     protoimpl.SizeCache
+	unknownFields protoimpl.UnknownFields
+
+	DocId string `protobuf:"bytes,1,opt,name=docId,proto3" json:"docId,omitempty"` //文档id
+}
+
+func (x *UserDeleteRequest) Reset() {
+	*x = UserDeleteRequest{}
+	if protoimpl.UnsafeEnabled {
+		mi := &file_userlib_proto_msgTypes[2]
+		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+		ms.StoreMessageInfo(mi)
+	}
+}
+
+func (x *UserDeleteRequest) String() string {
+	return protoimpl.X.MessageStringOf(x)
+}
+
+func (*UserDeleteRequest) ProtoMessage() {}
+
+func (x *UserDeleteRequest) ProtoReflect() protoreflect.Message {
+	mi := &file_userlib_proto_msgTypes[2]
+	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 UserDeleteRequest.ProtoReflect.Descriptor instead.
+func (*UserDeleteRequest) Descriptor() ([]byte, []int) {
+	return file_userlib_proto_rawDescGZIP(), []int{2}
+}
+
+func (x *UserDeleteRequest) GetDocId() string {
+	if x != nil {
+		return x.DocId
+	}
+	return ""
+}
+
+type UserDeleteResponse 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"` //响应消息
+}
+
+func (x *UserDeleteResponse) Reset() {
+	*x = UserDeleteResponse{}
+	if protoimpl.UnsafeEnabled {
+		mi := &file_userlib_proto_msgTypes[3]
+		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+		ms.StoreMessageInfo(mi)
+	}
+}
+
+func (x *UserDeleteResponse) String() string {
+	return protoimpl.X.MessageStringOf(x)
+}
+
+func (*UserDeleteResponse) ProtoMessage() {}
+
+func (x *UserDeleteResponse) ProtoReflect() protoreflect.Message {
+	mi := &file_userlib_proto_msgTypes[3]
+	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 UserDeleteResponse.ProtoReflect.Descriptor instead.
+func (*UserDeleteResponse) Descriptor() ([]byte, []int) {
+	return file_userlib_proto_rawDescGZIP(), []int{3}
+}
+
+func (x *UserDeleteResponse) GetCode() int32 {
+	if x != nil {
+		return x.Code
+	}
+	return 0
+}
+
+func (x *UserDeleteResponse) GetMessage() string {
+	if x != nil {
+		return x.Message
+	}
+	return ""
+}
+
+//用户恢复
+type UserRestoreRequest struct {
+	state         protoimpl.MessageState
+	sizeCache     protoimpl.SizeCache
+	unknownFields protoimpl.UnknownFields
+
+	DocId string `protobuf:"bytes,1,opt,name=docId,proto3" json:"docId,omitempty"` //文档id
+}
+
+func (x *UserRestoreRequest) Reset() {
+	*x = UserRestoreRequest{}
+	if protoimpl.UnsafeEnabled {
+		mi := &file_userlib_proto_msgTypes[4]
+		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+		ms.StoreMessageInfo(mi)
+	}
+}
+
+func (x *UserRestoreRequest) String() string {
+	return protoimpl.X.MessageStringOf(x)
+}
+
+func (*UserRestoreRequest) ProtoMessage() {}
+
+func (x *UserRestoreRequest) ProtoReflect() protoreflect.Message {
+	mi := &file_userlib_proto_msgTypes[4]
+	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 UserRestoreRequest.ProtoReflect.Descriptor instead.
+func (*UserRestoreRequest) Descriptor() ([]byte, []int) {
+	return file_userlib_proto_rawDescGZIP(), []int{4}
+}
+
+func (x *UserRestoreRequest) GetDocId() string {
+	if x != nil {
+		return x.DocId
+	}
+	return ""
+}
+
+type UserRestoreResponse 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"` //响应消息
+}
+
+func (x *UserRestoreResponse) Reset() {
+	*x = UserRestoreResponse{}
+	if protoimpl.UnsafeEnabled {
+		mi := &file_userlib_proto_msgTypes[5]
+		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+		ms.StoreMessageInfo(mi)
+	}
+}
+
+func (x *UserRestoreResponse) String() string {
+	return protoimpl.X.MessageStringOf(x)
+}
+
+func (*UserRestoreResponse) ProtoMessage() {}
+
+func (x *UserRestoreResponse) ProtoReflect() protoreflect.Message {
+	mi := &file_userlib_proto_msgTypes[5]
+	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 UserRestoreResponse.ProtoReflect.Descriptor instead.
+func (*UserRestoreResponse) Descriptor() ([]byte, []int) {
+	return file_userlib_proto_rawDescGZIP(), []int{5}
+}
+
+func (x *UserRestoreResponse) GetCode() int32 {
+	if x != nil {
+		return x.Code
+	}
+	return 0
+}
+
+func (x *UserRestoreResponse) GetMessage() string {
+	if x != nil {
+		return x.Message
+	}
+	return ""
+}
+
+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,
+	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, 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,
+}
+
+var (
+	file_userlib_proto_rawDescOnce sync.Once
+	file_userlib_proto_rawDescData = file_userlib_proto_rawDesc
+)
+
+func file_userlib_proto_rawDescGZIP() []byte {
+	file_userlib_proto_rawDescOnce.Do(func() {
+		file_userlib_proto_rawDescData = protoimpl.X.CompressGZIP(file_userlib_proto_rawDescData)
+	})
+	return file_userlib_proto_rawDescData
+}
+
+var file_userlib_proto_enumTypes = make([]protoimpl.EnumInfo, 3)
+var file_userlib_proto_msgTypes = make([]protoimpl.MessageInfo, 6)
+var file_userlib_proto_goTypes = []interface{}{
+	(UserDocCategory)(0),        // 0: userlib.UserDocCategory
+	(UserDocFileType)(0),        // 1: userlib.UserDocFileType
+	(UserDocStatus)(0),          // 2: userlib.UserDocStatus
+	(*UserCollectRequest)(nil),  // 3: userlib.UserCollectRequest
+	(*UserCollectResponse)(nil), // 4: userlib.UserCollectResponse
+	(*UserDeleteRequest)(nil),   // 5: userlib.UserDeleteRequest
+	(*UserDeleteResponse)(nil),  // 6: userlib.UserDeleteResponse
+	(*UserRestoreRequest)(nil),  // 7: userlib.UserRestoreRequest
+	(*UserRestoreResponse)(nil), // 8: userlib.UserRestoreResponse
+}
+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
+}
+
+func init() { file_userlib_proto_init() }
+func file_userlib_proto_init() {
+	if File_userlib_proto != nil {
+		return
+	}
+	if !protoimpl.UnsafeEnabled {
+		file_userlib_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
+			switch v := v.(*UserCollectRequest); i {
+			case 0:
+				return &v.state
+			case 1:
+				return &v.sizeCache
+			case 2:
+				return &v.unknownFields
+			default:
+				return nil
+			}
+		}
+		file_userlib_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
+			switch v := v.(*UserCollectResponse); i {
+			case 0:
+				return &v.state
+			case 1:
+				return &v.sizeCache
+			case 2:
+				return &v.unknownFields
+			default:
+				return nil
+			}
+		}
+		file_userlib_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
+			switch v := v.(*UserDeleteRequest); i {
+			case 0:
+				return &v.state
+			case 1:
+				return &v.sizeCache
+			case 2:
+				return &v.unknownFields
+			default:
+				return nil
+			}
+		}
+		file_userlib_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
+			switch v := v.(*UserDeleteResponse); i {
+			case 0:
+				return &v.state
+			case 1:
+				return &v.sizeCache
+			case 2:
+				return &v.unknownFields
+			default:
+				return nil
+			}
+		}
+		file_userlib_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
+			switch v := v.(*UserRestoreRequest); i {
+			case 0:
+				return &v.state
+			case 1:
+				return &v.sizeCache
+			case 2:
+				return &v.unknownFields
+			default:
+				return nil
+			}
+		}
+		file_userlib_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
+			switch v := v.(*UserRestoreResponse); 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{
+		File: protoimpl.DescBuilder{
+			GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
+			RawDescriptor: file_userlib_proto_rawDesc,
+			NumEnums:      3,
+			NumMessages:   6,
+			NumExtensions: 0,
+			NumServices:   1,
+		},
+		GoTypes:           file_userlib_proto_goTypes,
+		DependencyIndexes: file_userlib_proto_depIdxs,
+		EnumInfos:         file_userlib_proto_enumTypes,
+		MessageInfos:      file_userlib_proto_msgTypes,
+	}.Build()
+	File_userlib_proto = out.File
+	file_userlib_proto_rawDesc = nil
+	file_userlib_proto_goTypes = nil
+	file_userlib_proto_depIdxs = nil
+}
+
+// Reference imports to suppress errors if they are not otherwise used.
+var _ context.Context
+var _ grpc.ClientConnInterface
+
+// This is a compile-time assertion to ensure that this generated file
+// is compatible with the grpc package it is being compiled against.
+const _ = grpc.SupportPackageIsVersion6
+
+// UserLibClient is the client API for UserLib service.
+//
+// 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 {
+	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)
+}
+
+type userLibClient struct {
+	cc grpc.ClientConnInterface
+}
+
+func NewUserLibClient(cc grpc.ClientConnInterface) UserLibClient {
+	return &userLibClient{cc}
+}
+
+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...)
+	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...)
+	if err != nil {
+		return nil, err
+	}
+	return out, nil
+}
+
+func (c *userLibClient) DocRestore(ctx context.Context, in *UserRestoreRequest, opts ...grpc.CallOption) (*UserRestoreResponse, error) {
+	out := new(UserRestoreResponse)
+	err := c.cc.Invoke(ctx, "/userlib.UserLib/DocRestore", in, out, opts...)
+	if err != nil {
+		return nil, err
+	}
+	return out, nil
+}
+
+// UserLibServer is the server API for UserLib service.
+type UserLibServer interface {
+	DocCollect(context.Context, *UserCollectRequest) (*UserCollectResponse, error)
+	DocDelete(context.Context, *UserDeleteRequest) (*UserDeleteResponse, error)
+	DocRestore(context.Context, *UserRestoreRequest) (*UserRestoreResponse, error)
+}
+
+// UnimplementedUserLibServer can be embedded to have forward compatible implementations.
+type UnimplementedUserLibServer struct {
+}
+
+func (*UnimplementedUserLibServer) DocCollect(context.Context, *UserCollectRequest) (*UserCollectResponse, error) {
+	return nil, status.Errorf(codes.Unimplemented, "method DocCollect not implemented")
+}
+func (*UnimplementedUserLibServer) DocDelete(context.Context, *UserDeleteRequest) (*UserDeleteResponse, error) {
+	return nil, status.Errorf(codes.Unimplemented, "method DocDelete not implemented")
+}
+func (*UnimplementedUserLibServer) DocRestore(context.Context, *UserRestoreRequest) (*UserRestoreResponse, error) {
+	return nil, status.Errorf(codes.Unimplemented, "method DocRestore not implemented")
+}
+
+func RegisterUserLibServer(s *grpc.Server, srv UserLibServer) {
+	s.RegisterService(&_UserLib_serviceDesc, srv)
+}
+
+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 {
+		return nil, err
+	}
+	if interceptor == nil {
+		return srv.(UserLibServer).DocCollect(ctx, in)
+	}
+	info := &grpc.UnaryServerInfo{
+		Server:     srv,
+		FullMethod: "/userlib.UserLib/DocCollect",
+	}
+	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+		return srv.(UserLibServer).DocCollect(ctx, req.(*UserCollectRequest))
+	}
+	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 {
+		return nil, err
+	}
+	if interceptor == nil {
+		return srv.(UserLibServer).DocDelete(ctx, in)
+	}
+	info := &grpc.UnaryServerInfo{
+		Server:     srv,
+		FullMethod: "/userlib.UserLib/DocDelete",
+	}
+	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+		return srv.(UserLibServer).DocDelete(ctx, req.(*UserDeleteRequest))
+	}
+	return interceptor(ctx, in, info, handler)
+}
+
+func _UserLib_DocRestore_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+	in := new(UserRestoreRequest)
+	if err := dec(in); err != nil {
+		return nil, err
+	}
+	if interceptor == nil {
+		return srv.(UserLibServer).DocRestore(ctx, in)
+	}
+	info := &grpc.UnaryServerInfo{
+		Server:     srv,
+		FullMethod: "/userlib.UserLib/DocRestore",
+	}
+	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+		return srv.(UserLibServer).DocRestore(ctx, req.(*UserRestoreRequest))
+	}
+	return interceptor(ctx, in, info, handler)
+}
+
+var _UserLib_serviceDesc = grpc.ServiceDesc{
+	ServiceName: "userlib.UserLib",
+	HandlerType: (*UserLibServer)(nil),
+	Methods: []grpc.MethodDesc{
+		{
+			MethodName: "DocCollect",
+			Handler:    _UserLib_DocCollect_Handler,
+		},
+		{
+			MethodName: "DocDelete",
+			Handler:    _UserLib_DocDelete_Handler,
+		},
+		{
+			MethodName: "DocRestore",
+			Handler:    _UserLib_DocRestore_Handler,
+		},
+	},
+	Streams:  []grpc.StreamDesc{},
+	Metadata: "userlib.proto",
+}

+ 54 - 0
rpc/userlib/userlibclient/userlib.go

@@ -0,0 +1,54 @@
+// Code generated by goctl. DO NOT EDIT!
+// Source: userlib.proto
+
+//go:generate mockgen -destination ./userlib_mock.go -package userlibclient -source $GOFILE
+
+package userlibclient
+
+import (
+	"context"
+
+	"app.yhyue.com/moapp/jydocs/rpc/userlib/userlib"
+
+	"github.com/tal-tech/go-zero/zrpc"
+)
+
+type (
+	UserRestoreRequest  = userlib.UserRestoreRequest
+	UserRestoreResponse = userlib.UserRestoreResponse
+	UserCollectRequest  = userlib.UserCollectRequest
+	UserCollectResponse = userlib.UserCollectResponse
+	UserDeleteRequest   = userlib.UserDeleteRequest
+	UserDeleteResponse  = userlib.UserDeleteResponse
+
+	UserLib interface {
+		DocCollect(ctx context.Context, in *UserCollectRequest) (*UserCollectResponse, error)
+		DocDelete(ctx context.Context, in *UserDeleteRequest) (*UserDeleteResponse, error)
+		DocRestore(ctx context.Context, in *UserRestoreRequest) (*UserRestoreResponse, error)
+	}
+
+	defaultUserLib struct {
+		cli zrpc.Client
+	}
+)
+
+func NewUserLib(cli zrpc.Client) UserLib {
+	return &defaultUserLib{
+		cli: cli,
+	}
+}
+
+func (m *defaultUserLib) DocCollect(ctx context.Context, in *UserCollectRequest) (*UserCollectResponse, error) {
+	client := userlib.NewUserLibClient(m.cli.Conn())
+	return client.DocCollect(ctx, in)
+}
+
+func (m *defaultUserLib) DocDelete(ctx context.Context, in *UserDeleteRequest) (*UserDeleteResponse, error) {
+	client := userlib.NewUserLibClient(m.cli.Conn())
+	return client.DocDelete(ctx, in)
+}
+
+func (m *defaultUserLib) DocRestore(ctx context.Context, in *UserRestoreRequest) (*UserRestoreResponse, error) {
+	client := userlib.NewUserLibClient(m.cli.Conn())
+	return client.DocRestore(ctx, in)
+}

+ 15 - 2
services/util/baseInit.go

@@ -7,13 +7,26 @@ import (
 	"log"
 )
 
+type MysqlDBConfig struct {
+	DriverName      string
+	DataSourceName  string
+	MaxOpenConn     int
+	MaxIdleConn     int
+	MaxConnLifeTime int
+}
+
+type EsConfig struct {
+	Addr string
+	Pool int
+}
+
 var (
 	jyDocsDB *gorm.DB
 )
 
 func InitDB(url, driverName string, maxOpenConn, maxIdle int) {
-	docDB := mysql.GormMysql(url, driverName, maxOpenConn, maxIdle, nil)
-	if docDB != nil {
+	jyDocsDB = mysql.GormMysql(url, driverName, maxOpenConn, maxIdle, nil)
+	if jyDocsDB != nil {
 		log.Printf("----------->【jy_docs】 DB :[%s] 初始化成功!<--------------", url)
 	} else {
 		log.Fatalf("----------->【jy_docs】 DB初始化失败<--------------")