WH01243 4 anni fa
parent
commit
2fce16c438

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

@@ -11,7 +11,7 @@ FileSystemConf:
     Key: integral.rpc
 JyDocsMysqlDB:
   DriverName: "mysql"
-  DataSourceName: "root:root@tcp(127.0.0.1:3306)/jydocs?charset=utf8mb4&parseTime=true&loc=Local"
+  DataSourceName: "root:Topnet123@tcp(192.168.3.11:3366)/jydocs?charset=utf8mb4&parseTime=true&loc=Local"
   MaxOpenConn: 20
   MaxIdleConn: 10
   MaxConnLifeTime: 100

+ 6 - 6
rpc/userlib/internal/logic/docdeletelogic.go

@@ -23,17 +23,17 @@ func NewDocDeleteLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DocDele
 		Logger: logx.WithContext(ctx),
 	}
 }
-
-func (l *DocDeleteLogic) DocDelete(in *userlib.UserDeleteRequest) (*userlib.UserDeleteResponse, error) {
+//删除文档
+func (l *DocDeleteLogic) DocDelete(in *userlib.UserRecoveryRequest) (*userlib.UserDeleteResponse, error) {
 	// todo: add your logic here and delete this line
 	result := &userlib.UserDeleteResponse{}
-	b := userLibService.UserDocDelete(in.DocId)
-	if b {
+	code,msg:= userLibService.UserDocDelete(in.UserDocId)
+	if code {
 		result.Code = 1
-		result.Message = "删除成功"
+		result.Message = msg
 		return result,nil
 	}
 	result.Code = 0
-	result.Message = "删除失败"
+	result.Message = msg
 	return result, nil
 }

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

@@ -32,20 +32,7 @@ func (l *DocDownloadLogic) DocDownload(in *userlib.UserCollectRequest) (*userlib
 		&model.UserDoc{
 			UserId:          in.UserId,
 			DocId:           in.DocId,
-<<<<<<< HEAD
-			DocCategory:     int(in.DocCategory),
-			IsDelete:        int(userlib.UserDocStatus_Normal),
-			DocName:         in.DocName,
-			DocFileType:     int(in.DocFileType),
-			DocFileSuffix:   in.DocFileSuffix,
-			DocFileSize:     int(in.DocFileSize),
-			DocPageSize:     int(in.DocPageSize),
-			DocSummary:      in.DocSummary,
-			DocSourceUserId: in.SourceUserId,
 		}, int(in.Cost), config.Configs.FileSystemConf.Etcd.Hosts, config.Configs.FileSystemConf.Etcd.Key)
-=======
-		}, int(in.Cost),config.Configs.FileSystemConf.Etcd.Hosts,config.Configs.FileSystemConf.Etcd.Key)
->>>>>>> da3594f67ecdc12ecfff7b4a4a66f0ffb82bf39b
 	log.Printf("用户文档收藏,userId:[%s],docId:[%s] 是否成功:[%v]", in.UserId, in.DocId, b)
 	if b {
 		return &userlib.UserCollectResponse{

+ 38 - 0
rpc/userlib/internal/logic/docpermanentdeletelogic.go

@@ -0,0 +1,38 @@
+package logic
+
+import (
+	"app.yhyue.com/moapp/jy_docs/rpc/userlib/internal/svc"
+	"app.yhyue.com/moapp/jy_docs/rpc/userlib/userlib"
+	userLibService "app.yhyue.com/moapp/jy_docs/services/userlib"
+	"context"
+
+	"github.com/tal-tech/go-zero/core/logx"
+)
+
+type DocPermanentDeleteLogic struct {
+	ctx    context.Context
+	svcCtx *svc.ServiceContext
+	logx.Logger
+}
+
+func NewDocPermanentDeleteLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DocPermanentDeleteLogic {
+	return &DocPermanentDeleteLogic{
+		ctx:    ctx,
+		svcCtx: svcCtx,
+		Logger: logx.WithContext(ctx),
+	}
+}
+
+func (l *DocPermanentDeleteLogic) DocPermanentDelete(in *userlib.UserRecoveryRequest) (*userlib.UserCollectResponse, error) {
+	// todo: add your logic here and delete this line
+	result := &userlib.UserCollectResponse{}
+	code,msg:= userLibService.UserDocPermanentDelete(in.UserDocId)
+	if code {
+		result.Code = 1
+		result.Message = msg
+		return result,nil
+	}
+	result.Code = 0
+	result.Message = msg
+	return result, nil
+}

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

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

+ 13 - 5
rpc/userlib/internal/logic/docrestorelogic.go

@@ -1,10 +1,10 @@
 package logic
 
 import (
-	"context"
-
 	"app.yhyue.com/moapp/jy_docs/rpc/userlib/internal/svc"
 	"app.yhyue.com/moapp/jy_docs/rpc/userlib/userlib"
+	userLibService "app.yhyue.com/moapp/jy_docs/services/userlib"
+	"context"
 
 	"github.com/tal-tech/go-zero/core/logx"
 )
@@ -23,8 +23,16 @@ func NewDocRestoreLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DocRes
 	}
 }
 
-func (l *DocRestoreLogic) DocRestore(in *userlib.UserRestoreRequest) (*userlib.UserRestoreResponse, error) {
+func (l *DocRestoreLogic) DocRestore(in *userlib.UserRecoveryRequest) (*userlib.UserRestoreResponse, error) {
 	// todo: add your logic here and delete this line
-
-	return &userlib.UserRestoreResponse{}, nil
+	result := &userlib.UserRestoreResponse{}
+	code,msg:= userLibService.UserDocRestore(in.UserDocId)
+	if code {
+		result.Code = 1
+		result.Message =msg
+		return result, nil
+	}
+	result.Code = 0
+	result.Message = msg
+	return result, nil
 }

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

@@ -36,12 +36,12 @@ func (s *UserLibServer) DocCancelCollect(ctx context.Context, in *userlib.UserDe
 	return l.DocCancelCollect(in)
 }
 
-func (s *UserLibServer) DocDelete(ctx context.Context, in *userlib.UserDeleteRequest) (*userlib.UserDeleteResponse, error) {
+func (s *UserLibServer) DocDelete(ctx context.Context, in *userlib.UserRecoveryRequest) (*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) {
+func (s *UserLibServer) DocRestore(ctx context.Context, in *userlib.UserRecoveryRequest) (*userlib.UserRestoreResponse, error) {
 	l := logic.NewDocRestoreLogic(ctx, s.svcCtx)
 	return l.DocRestore(in)
 }
@@ -51,7 +51,7 @@ func (s *UserLibServer) DocDownload(ctx context.Context, in *userlib.UserCollect
 	return l.DocDownload(in)
 }
 
-func (s *UserLibServer) DocRecycle(ctx context.Context, in *userlib.UserRecoveryRequest) (*userlib.UserCollectResponse, error) {
-	l := logic.NewDocRecycleLogic(ctx, s.svcCtx)
-	return l.DocRecycle(in)
+func (s *UserLibServer) DocPermanentDelete(ctx context.Context, in *userlib.UserRecoveryRequest) (*userlib.UserCollectResponse, error) {
+	l := logic.NewDocPermanentDeleteLogic(ctx, s.svcCtx)
+	return l.DocPermanentDelete(in)
 }

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

@@ -46,17 +46,51 @@ func Test_UserCancelDocCollect(t *testing.T) {
 	}
 	log.Print("UserDoc Collect call response:", resp)
 }
-
+//下载删除
 func Test_UserDocDelete(t *testing.T)  {
 	client := zrpc.MustNewClient(zrpc.RpcClientConf{
 		Etcd: discov.EtcdConf{
-			Hosts: []string{"127.0.0.1:2379"},
+			Hosts: []string{"127.0.0.1:2380"},
+			Key:   "jydocs.userlib.rpc",
+		},
+	})
+	userLib := userlibclient.NewUserLib(client)
+	resp, err := userLib.DocDelete(context.Background(), &userlibclient.UserRecoveryRequest{
+		UserDocId: int32(10),
+	})
+	if err != nil {
+		log.Println("UserDoc Collect call error:", err)
+	}
+	log.Print("UserDoc Collect call response:", resp)
+}
+//删除找回
+func Test_UserDocRestore(t *testing.T)  {
+	client := zrpc.MustNewClient(zrpc.RpcClientConf{
+		Etcd: discov.EtcdConf{
+			Hosts: []string{"127.0.0.1:2380"},
+			Key:   "jydocs.userlib.rpc",
+		},
+	})
+	userLib := userlibclient.NewUserLib(client)
+	resp, err := userLib.DocRestore(context.Background(), &userlibclient.UserRecoveryRequest{
+		UserDocId: int32(10),
+	})
+	if err != nil {
+		log.Println("UserDoc Collect call error:", err)
+	}
+	log.Print("UserDoc Collect call response:", resp)
+}
+//永久删除
+func Test_UserDocPermanentDelete(t *testing.T)  {
+	client := zrpc.MustNewClient(zrpc.RpcClientConf{
+		Etcd: discov.EtcdConf{
+			Hosts: []string{"127.0.0.1:2380"},
 			Key:   "jydocs.userlib.rpc",
 		},
 	})
 	userLib := userlibclient.NewUserLib(client)
-	resp, err := userLib.DocDelete(context.Background(), &userlibclient.UserDeleteRequest{
-		DocId: "1",
+	resp, err := userLib.DocPermanentDelete(context.Background(), &userlibclient.UserRecoveryRequest{
+		UserDocId: int32(10),
 	})
 	if err != nil {
 		log.Println("UserDoc Collect call error:", err)

+ 4 - 8
rpc/userlib/userlib.proto

@@ -57,12 +57,8 @@ message UserDocsResponse {
     int32 code =1;    //响应代码
     string message=2; //响应消息
 }
-//回收站操作1进入回收站2永久删除3删除改为未删除
 message UserRecoveryRequest {
-    string userId=1; //用户id
-    string docId=2; //文档id
-    string id =3;   //记录标识
-    UserDocStatus   userDocStatus=4;//记录状态
+    int32 userDocId =1;   //记录标识
 }
 enum UserDocStatus {
     Normal =0;//文件正常
@@ -73,8 +69,8 @@ service  UserLib {
     rpc UserDocs(UserDocsRequest) returns (UserDocsResponse);//用户文档列表
   	rpc DocCollect(UserCollectRequest) returns(UserCollectResponse); //文档收藏
   	rpc DocCancelCollect(UserDeleteRequest) returns(UserDeleteResponse); //文档取消收藏
-	rpc DocDelete(UserDeleteRequest) returns(UserDeleteResponse); //文档删除
-	rpc DocRestore(UserRestoreRequest) returns(UserRestoreResponse); //文档恢复
+	rpc DocDelete(UserRecoveryRequest) returns(UserDeleteResponse); //文档删除
+	rpc DocRestore(UserRecoveryRequest) returns(UserRestoreResponse); //文档恢复
 	rpc DocDownload(UserCollectRequest) returns(UserCollectResponse); //文档转存
-	rpc DocRecycle(UserRecoveryRequest)returns(UserCollectResponse); //回收站
+	rpc DocPermanentDelete(UserRecoveryRequest)returns(UserCollectResponse); //永久删除
 }

+ 96 - 127
rpc/userlib/userlib/userlib.pb.go

@@ -1,7 +1,7 @@
 // Code generated by protoc-gen-go. DO NOT EDIT.
 // versions:
 // 	protoc-gen-go v1.25.0
-// 	protoc        v3.15.3
+// 	protoc        v3.15.1
 // source: userlib.proto
 
 package userlib
@@ -623,16 +623,12 @@ func (x *UserDocsResponse) GetMessage() string {
 	return ""
 }
 
-//回收站操作1进入回收站2永久删除3删除改为未删除
 type UserRecoveryRequest 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
-	Id            string        `protobuf:"bytes,3,opt,name=id,proto3" json:"id,omitempty"`                                                   //记录标识
-	UserDocStatus UserDocStatus `protobuf:"varint,4,opt,name=userDocStatus,proto3,enum=userlib.UserDocStatus" json:"userDocStatus,omitempty"` //记录状态
+	UserDocId int32 `protobuf:"varint,1,opt,name=userDocId,proto3" json:"userDocId,omitempty"` //记录标识
 }
 
 func (x *UserRecoveryRequest) Reset() {
@@ -667,32 +663,11 @@ func (*UserRecoveryRequest) Descriptor() ([]byte, []int) {
 	return file_userlib_proto_rawDescGZIP(), []int{8}
 }
 
-func (x *UserRecoveryRequest) GetUserId() string {
+func (x *UserRecoveryRequest) GetUserDocId() int32 {
 	if x != nil {
-		return x.UserId
-	}
-	return ""
-}
-
-func (x *UserRecoveryRequest) GetDocId() string {
-	if x != nil {
-		return x.DocId
-	}
-	return ""
-}
-
-func (x *UserRecoveryRequest) GetId() string {
-	if x != nil {
-		return x.Id
+		return x.UserDocId
 	}
-	return ""
-}
-
-func (x *UserRecoveryRequest) GetUserDocStatus() UserDocStatus {
-	if x != nil {
-		return x.UserDocStatus
-	}
-	return UserDocStatus_Normal
+	return 0
 }
 
 var File_userlib_proto protoreflect.FileDescriptor
@@ -734,62 +709,57 @@ var file_userlib_proto_rawDesc = []byte{
 	0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65,
 	0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x18, 0x0a, 0x07,
 	0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d,
-	0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x91, 0x01, 0x0a, 0x13, 0x55, 0x73, 0x65, 0x72, 0x52,
-	0x65, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x16,
-	0x0a, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06,
-	0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x64, 0x6f, 0x63, 0x49, 0x64, 0x18,
-	0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x64, 0x6f, 0x63, 0x49, 0x64, 0x12, 0x0e, 0x0a, 0x02,
-	0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x3c, 0x0a, 0x0d,
-	0x75, 0x73, 0x65, 0x72, 0x44, 0x6f, 0x63, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x04, 0x20,
-	0x01, 0x28, 0x0e, 0x32, 0x16, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x6c, 0x69, 0x62, 0x2e, 0x55, 0x73,
-	0x65, 0x72, 0x44, 0x6f, 0x63, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x0d, 0x75, 0x73, 0x65,
-	0x72, 0x44, 0x6f, 0x63, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2a, 0x3c, 0x0a, 0x0f, 0x55, 0x73,
-	0x65, 0x72, 0x44, 0x6f, 0x63, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x12, 0x0e, 0x0a,
-	0x0a, 0x53, 0x65, 0x6c, 0x66, 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x10, 0x00, 0x12, 0x0c, 0x0a,
-	0x08, 0x44, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x10, 0x01, 0x12, 0x0b, 0x0a, 0x07, 0x43,
-	0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x10, 0x02, 0x2a, 0x4c, 0x0a, 0x0f, 0x55, 0x73, 0x65, 0x72,
-	0x44, 0x6f, 0x63, 0x46, 0x69, 0x6c, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x08, 0x0a, 0x04, 0x57,
-	0x6f, 0x72, 0x64, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, 0x50, 0x44, 0x46, 0x10, 0x01, 0x12, 0x09,
-	0x0a, 0x05, 0x45, 0x58, 0x43, 0x45, 0x4c, 0x10, 0x02, 0x12, 0x07, 0x0a, 0x03, 0x50, 0x50, 0x54,
-	0x10, 0x03, 0x12, 0x07, 0x0a, 0x03, 0x54, 0x58, 0x54, 0x10, 0x04, 0x12, 0x09, 0x0a, 0x05, 0x4f,
-	0x74, 0x68, 0x65, 0x72, 0x10, 0x05, 0x2a, 0x43, 0x0a, 0x0d, 0x55, 0x73, 0x65, 0x72, 0x44, 0x6f,
-	0x63, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x0a, 0x0a, 0x06, 0x4e, 0x6f, 0x72, 0x6d, 0x61,
-	0x6c, 0x10, 0x00, 0x12, 0x0f, 0x0a, 0x0b, 0x4c, 0x6f, 0x67, 0x69, 0x63, 0x44, 0x65, 0x6c, 0x65,
-	0x74, 0x65, 0x10, 0x01, 0x12, 0x15, 0x0a, 0x11, 0x50, 0x65, 0x72, 0x6d, 0x61, 0x6e, 0x65, 0x6e,
-	0x74, 0x6c, 0x79, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x10, 0x02, 0x32, 0x83, 0x04, 0x0a, 0x07,
-	0x55, 0x73, 0x65, 0x72, 0x4c, 0x69, 0x62, 0x12, 0x3f, 0x0a, 0x08, 0x55, 0x73, 0x65, 0x72, 0x44,
-	0x6f, 0x63, 0x73, 0x12, 0x18, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x6c, 0x69, 0x62, 0x2e, 0x55, 0x73,
-	0x65, 0x72, 0x44, 0x6f, 0x63, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e,
-	0x75, 0x73, 0x65, 0x72, 0x6c, 0x69, 0x62, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x44, 0x6f, 0x63, 0x73,
-	0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x47, 0x0a, 0x0a, 0x44, 0x6f, 0x63, 0x43,
-	0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x12, 0x1b, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x6c, 0x69, 0x62,
-	0x2e, 0x55, 0x73, 0x65, 0x72, 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x52, 0x65, 0x71, 0x75,
-	0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x6c, 0x69, 0x62, 0x2e, 0x55, 0x73,
-	0x65, 0x72, 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
-	0x65, 0x12, 0x4b, 0x0a, 0x10, 0x44, 0x6f, 0x63, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x43, 0x6f,
-	0x6c, 0x6c, 0x65, 0x63, 0x74, 0x12, 0x1a, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x6c, 0x69, 0x62, 0x2e,
-	0x55, 0x73, 0x65, 0x72, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
-	0x74, 0x1a, 0x1b, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x6c, 0x69, 0x62, 0x2e, 0x55, 0x73, 0x65, 0x72,
-	0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x44,
-	0x0a, 0x09, 0x44, 0x6f, 0x63, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x12, 0x1a, 0x2e, 0x75, 0x73,
-	0x65, 0x72, 0x6c, 0x69, 0x62, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65,
-	0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1b, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x6c, 0x69,
-	0x62, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70,
-	0x6f, 0x6e, 0x73, 0x65, 0x12, 0x47, 0x0a, 0x0a, 0x44, 0x6f, 0x63, 0x52, 0x65, 0x73, 0x74, 0x6f,
-	0x72, 0x65, 0x12, 0x1b, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x6c, 0x69, 0x62, 0x2e, 0x55, 0x73, 0x65,
-	0x72, 0x52, 0x65, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a,
-	0x1c, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x6c, 0x69, 0x62, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65,
-	0x73, 0x74, 0x6f, 0x72, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x48, 0x0a,
-	0x0b, 0x44, 0x6f, 0x63, 0x44, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x12, 0x1b, 0x2e, 0x75,
-	0x73, 0x65, 0x72, 0x6c, 0x69, 0x62, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x43, 0x6f, 0x6c, 0x6c, 0x65,
-	0x63, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x75, 0x73, 0x65, 0x72,
-	0x6c, 0x69, 0x62, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x52,
+	0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x33, 0x0a, 0x13, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65,
+	0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1c, 0x0a,
+	0x09, 0x75, 0x73, 0x65, 0x72, 0x44, 0x6f, 0x63, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05,
+	0x52, 0x09, 0x75, 0x73, 0x65, 0x72, 0x44, 0x6f, 0x63, 0x49, 0x64, 0x2a, 0x3c, 0x0a, 0x0f, 0x55,
+	0x73, 0x65, 0x72, 0x44, 0x6f, 0x63, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x12, 0x0e,
+	0x0a, 0x0a, 0x53, 0x65, 0x6c, 0x66, 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x10, 0x00, 0x12, 0x0c,
+	0x0a, 0x08, 0x44, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x10, 0x01, 0x12, 0x0b, 0x0a, 0x07,
+	0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x10, 0x02, 0x2a, 0x4c, 0x0a, 0x0f, 0x55, 0x73, 0x65,
+	0x72, 0x44, 0x6f, 0x63, 0x46, 0x69, 0x6c, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x08, 0x0a, 0x04,
+	0x57, 0x6f, 0x72, 0x64, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, 0x50, 0x44, 0x46, 0x10, 0x01, 0x12,
+	0x09, 0x0a, 0x05, 0x45, 0x58, 0x43, 0x45, 0x4c, 0x10, 0x02, 0x12, 0x07, 0x0a, 0x03, 0x50, 0x50,
+	0x54, 0x10, 0x03, 0x12, 0x07, 0x0a, 0x03, 0x54, 0x58, 0x54, 0x10, 0x04, 0x12, 0x09, 0x0a, 0x05,
+	0x4f, 0x74, 0x68, 0x65, 0x72, 0x10, 0x05, 0x2a, 0x43, 0x0a, 0x0d, 0x55, 0x73, 0x65, 0x72, 0x44,
+	0x6f, 0x63, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x0a, 0x0a, 0x06, 0x4e, 0x6f, 0x72, 0x6d,
+	0x61, 0x6c, 0x10, 0x00, 0x12, 0x0f, 0x0a, 0x0b, 0x4c, 0x6f, 0x67, 0x69, 0x63, 0x44, 0x65, 0x6c,
+	0x65, 0x74, 0x65, 0x10, 0x01, 0x12, 0x15, 0x0a, 0x11, 0x50, 0x65, 0x72, 0x6d, 0x61, 0x6e, 0x65,
+	0x6e, 0x74, 0x6c, 0x79, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x10, 0x02, 0x32, 0x8e, 0x04, 0x0a,
+	0x07, 0x55, 0x73, 0x65, 0x72, 0x4c, 0x69, 0x62, 0x12, 0x3f, 0x0a, 0x08, 0x55, 0x73, 0x65, 0x72,
+	0x44, 0x6f, 0x63, 0x73, 0x12, 0x18, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x6c, 0x69, 0x62, 0x2e, 0x55,
+	0x73, 0x65, 0x72, 0x44, 0x6f, 0x63, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19,
+	0x2e, 0x75, 0x73, 0x65, 0x72, 0x6c, 0x69, 0x62, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x44, 0x6f, 0x63,
+	0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x47, 0x0a, 0x0a, 0x44, 0x6f, 0x63,
+	0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x12, 0x1b, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x6c, 0x69,
+	0x62, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x52, 0x65, 0x71,
+	0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x6c, 0x69, 0x62, 0x2e, 0x55,
+	0x73, 0x65, 0x72, 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
+	0x73, 0x65, 0x12, 0x4b, 0x0a, 0x10, 0x44, 0x6f, 0x63, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x43,
+	0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x12, 0x1a, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x6c, 0x69, 0x62,
+	0x2e, 0x55, 0x73, 0x65, 0x72, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65,
+	0x73, 0x74, 0x1a, 0x1b, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x6c, 0x69, 0x62, 0x2e, 0x55, 0x73, 0x65,
+	0x72, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12,
+	0x46, 0x0a, 0x09, 0x44, 0x6f, 0x63, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x12, 0x1c, 0x2e, 0x75,
+	0x73, 0x65, 0x72, 0x6c, 0x69, 0x62, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x63, 0x6f, 0x76,
+	0x65, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 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, 0x48, 0x0a, 0x0a, 0x44, 0x6f, 0x63, 0x52, 0x65,
-	0x63, 0x79, 0x63, 0x6c, 0x65, 0x12, 0x1c, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x6c, 0x69, 0x62, 0x2e,
+	0x73, 0x74, 0x6f, 0x72, 0x65, 0x12, 0x1c, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x6c, 0x69, 0x62, 0x2e,
 	0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75,
 	0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x6c, 0x69, 0x62, 0x2e, 0x55, 0x73,
-	0x65, 0x72, 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
-	0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
+	0x65, 0x72, 0x52, 0x65, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
+	0x65, 0x12, 0x48, 0x0a, 0x0b, 0x44, 0x6f, 0x63, 0x44, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64,
+	0x12, 0x1b, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x6c, 0x69, 0x62, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x43,
+	0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e,
+	0x75, 0x73, 0x65, 0x72, 0x6c, 0x69, 0x62, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x43, 0x6f, 0x6c, 0x6c,
+	0x65, 0x63, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x50, 0x0a, 0x12, 0x44,
+	0x6f, 0x63, 0x50, 0x65, 0x72, 0x6d, 0x61, 0x6e, 0x65, 0x6e, 0x74, 0x44, 0x65, 0x6c, 0x65, 0x74,
+	0x65, 0x12, 0x1c, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x6c, 0x69, 0x62, 0x2e, 0x55, 0x73, 0x65, 0x72,
+	0x52, 0x65, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a,
+	0x1c, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x6c, 0x69, 0x62, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x43, 0x6f,
+	0x6c, 0x6c, 0x65, 0x63, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x62, 0x06, 0x70,
+	0x72, 0x6f, 0x74, 0x6f, 0x33,
 }
 
 var (
@@ -822,26 +792,25 @@ var file_userlib_proto_goTypes = []interface{}{
 }
 var file_userlib_proto_depIdxs = []int32{
 	0,  // 0: userlib.UserDocsRequest.userDocCategory:type_name -> userlib.UserDocCategory
-	2,  // 1: userlib.UserRecoveryRequest.userDocStatus:type_name -> userlib.UserDocStatus
-	9,  // 2: userlib.UserLib.UserDocs:input_type -> userlib.UserDocsRequest
-	3,  // 3: userlib.UserLib.DocCollect:input_type -> userlib.UserCollectRequest
-	5,  // 4: userlib.UserLib.DocCancelCollect:input_type -> userlib.UserDeleteRequest
-	5,  // 5: userlib.UserLib.DocDelete:input_type -> userlib.UserDeleteRequest
-	7,  // 6: userlib.UserLib.DocRestore:input_type -> userlib.UserRestoreRequest
-	3,  // 7: userlib.UserLib.DocDownload:input_type -> userlib.UserCollectRequest
-	11, // 8: userlib.UserLib.DocRecycle:input_type -> userlib.UserRecoveryRequest
-	10, // 9: userlib.UserLib.UserDocs:output_type -> userlib.UserDocsResponse
-	4,  // 10: userlib.UserLib.DocCollect:output_type -> userlib.UserCollectResponse
-	6,  // 11: userlib.UserLib.DocCancelCollect:output_type -> userlib.UserDeleteResponse
-	6,  // 12: userlib.UserLib.DocDelete:output_type -> userlib.UserDeleteResponse
-	8,  // 13: userlib.UserLib.DocRestore:output_type -> userlib.UserRestoreResponse
-	4,  // 14: userlib.UserLib.DocDownload:output_type -> userlib.UserCollectResponse
-	4,  // 15: userlib.UserLib.DocRecycle:output_type -> userlib.UserCollectResponse
-	9,  // [9:16] is the sub-list for method output_type
-	2,  // [2:9] is the sub-list for method input_type
-	2,  // [2:2] is the sub-list for extension type_name
-	2,  // [2:2] is the sub-list for extension extendee
-	0,  // [0:2] is the sub-list for field type_name
+	9,  // 1: userlib.UserLib.UserDocs:input_type -> userlib.UserDocsRequest
+	3,  // 2: userlib.UserLib.DocCollect:input_type -> userlib.UserCollectRequest
+	5,  // 3: userlib.UserLib.DocCancelCollect:input_type -> userlib.UserDeleteRequest
+	11, // 4: userlib.UserLib.DocDelete:input_type -> userlib.UserRecoveryRequest
+	11, // 5: userlib.UserLib.DocRestore:input_type -> userlib.UserRecoveryRequest
+	3,  // 6: userlib.UserLib.DocDownload:input_type -> userlib.UserCollectRequest
+	11, // 7: userlib.UserLib.DocPermanentDelete:input_type -> userlib.UserRecoveryRequest
+	10, // 8: userlib.UserLib.UserDocs:output_type -> userlib.UserDocsResponse
+	4,  // 9: userlib.UserLib.DocCollect:output_type -> userlib.UserCollectResponse
+	6,  // 10: userlib.UserLib.DocCancelCollect:output_type -> userlib.UserDeleteResponse
+	6,  // 11: userlib.UserLib.DocDelete:output_type -> userlib.UserDeleteResponse
+	8,  // 12: userlib.UserLib.DocRestore:output_type -> userlib.UserRestoreResponse
+	4,  // 13: userlib.UserLib.DocDownload:output_type -> userlib.UserCollectResponse
+	4,  // 14: userlib.UserLib.DocPermanentDelete:output_type -> userlib.UserCollectResponse
+	8,  // [8:15] is the sub-list for method output_type
+	1,  // [1:8] is the sub-list for method input_type
+	1,  // [1:1] is the sub-list for extension type_name
+	1,  // [1:1] is the sub-list for extension extendee
+	0,  // [0:1] is the sub-list for field type_name
 }
 
 func init() { file_userlib_proto_init() }
@@ -995,10 +964,10 @@ type UserLibClient interface {
 	UserDocs(ctx context.Context, in *UserDocsRequest, opts ...grpc.CallOption) (*UserDocsResponse, error)
 	DocCollect(ctx context.Context, in *UserCollectRequest, opts ...grpc.CallOption) (*UserCollectResponse, error)
 	DocCancelCollect(ctx context.Context, in *UserDeleteRequest, opts ...grpc.CallOption) (*UserDeleteResponse, error)
-	DocDelete(ctx context.Context, in *UserDeleteRequest, opts ...grpc.CallOption) (*UserDeleteResponse, error)
-	DocRestore(ctx context.Context, in *UserRestoreRequest, opts ...grpc.CallOption) (*UserRestoreResponse, error)
+	DocDelete(ctx context.Context, in *UserRecoveryRequest, opts ...grpc.CallOption) (*UserDeleteResponse, error)
+	DocRestore(ctx context.Context, in *UserRecoveryRequest, opts ...grpc.CallOption) (*UserRestoreResponse, error)
 	DocDownload(ctx context.Context, in *UserCollectRequest, opts ...grpc.CallOption) (*UserCollectResponse, error)
-	DocRecycle(ctx context.Context, in *UserRecoveryRequest, opts ...grpc.CallOption) (*UserCollectResponse, error)
+	DocPermanentDelete(ctx context.Context, in *UserRecoveryRequest, opts ...grpc.CallOption) (*UserCollectResponse, error)
 }
 
 type userLibClient struct {
@@ -1036,7 +1005,7 @@ func (c *userLibClient) DocCancelCollect(ctx context.Context, in *UserDeleteRequ
 	return out, nil
 }
 
-func (c *userLibClient) DocDelete(ctx context.Context, in *UserDeleteRequest, opts ...grpc.CallOption) (*UserDeleteResponse, error) {
+func (c *userLibClient) DocDelete(ctx context.Context, in *UserRecoveryRequest, opts ...grpc.CallOption) (*UserDeleteResponse, error) {
 	out := new(UserDeleteResponse)
 	err := c.cc.Invoke(ctx, "/userlib.UserLib/DocDelete", in, out, opts...)
 	if err != nil {
@@ -1045,7 +1014,7 @@ func (c *userLibClient) DocDelete(ctx context.Context, in *UserDeleteRequest, op
 	return out, nil
 }
 
-func (c *userLibClient) DocRestore(ctx context.Context, in *UserRestoreRequest, opts ...grpc.CallOption) (*UserRestoreResponse, error) {
+func (c *userLibClient) DocRestore(ctx context.Context, in *UserRecoveryRequest, opts ...grpc.CallOption) (*UserRestoreResponse, error) {
 	out := new(UserRestoreResponse)
 	err := c.cc.Invoke(ctx, "/userlib.UserLib/DocRestore", in, out, opts...)
 	if err != nil {
@@ -1063,9 +1032,9 @@ func (c *userLibClient) DocDownload(ctx context.Context, in *UserCollectRequest,
 	return out, nil
 }
 
-func (c *userLibClient) DocRecycle(ctx context.Context, in *UserRecoveryRequest, opts ...grpc.CallOption) (*UserCollectResponse, error) {
+func (c *userLibClient) DocPermanentDelete(ctx context.Context, in *UserRecoveryRequest, opts ...grpc.CallOption) (*UserCollectResponse, error) {
 	out := new(UserCollectResponse)
-	err := c.cc.Invoke(ctx, "/userlib.UserLib/DocRecycle", in, out, opts...)
+	err := c.cc.Invoke(ctx, "/userlib.UserLib/DocPermanentDelete", in, out, opts...)
 	if err != nil {
 		return nil, err
 	}
@@ -1077,10 +1046,10 @@ type UserLibServer interface {
 	UserDocs(context.Context, *UserDocsRequest) (*UserDocsResponse, error)
 	DocCollect(context.Context, *UserCollectRequest) (*UserCollectResponse, error)
 	DocCancelCollect(context.Context, *UserDeleteRequest) (*UserDeleteResponse, error)
-	DocDelete(context.Context, *UserDeleteRequest) (*UserDeleteResponse, error)
-	DocRestore(context.Context, *UserRestoreRequest) (*UserRestoreResponse, error)
+	DocDelete(context.Context, *UserRecoveryRequest) (*UserDeleteResponse, error)
+	DocRestore(context.Context, *UserRecoveryRequest) (*UserRestoreResponse, error)
 	DocDownload(context.Context, *UserCollectRequest) (*UserCollectResponse, error)
-	DocRecycle(context.Context, *UserRecoveryRequest) (*UserCollectResponse, error)
+	DocPermanentDelete(context.Context, *UserRecoveryRequest) (*UserCollectResponse, error)
 }
 
 // UnimplementedUserLibServer can be embedded to have forward compatible implementations.
@@ -1096,17 +1065,17 @@ func (*UnimplementedUserLibServer) DocCollect(context.Context, *UserCollectReque
 func (*UnimplementedUserLibServer) DocCancelCollect(context.Context, *UserDeleteRequest) (*UserDeleteResponse, error) {
 	return nil, status.Errorf(codes.Unimplemented, "method DocCancelCollect not implemented")
 }
-func (*UnimplementedUserLibServer) DocDelete(context.Context, *UserDeleteRequest) (*UserDeleteResponse, error) {
+func (*UnimplementedUserLibServer) DocDelete(context.Context, *UserRecoveryRequest) (*UserDeleteResponse, error) {
 	return nil, status.Errorf(codes.Unimplemented, "method DocDelete not implemented")
 }
-func (*UnimplementedUserLibServer) DocRestore(context.Context, *UserRestoreRequest) (*UserRestoreResponse, error) {
+func (*UnimplementedUserLibServer) DocRestore(context.Context, *UserRecoveryRequest) (*UserRestoreResponse, error) {
 	return nil, status.Errorf(codes.Unimplemented, "method DocRestore not implemented")
 }
 func (*UnimplementedUserLibServer) DocDownload(context.Context, *UserCollectRequest) (*UserCollectResponse, error) {
 	return nil, status.Errorf(codes.Unimplemented, "method DocDownload not implemented")
 }
-func (*UnimplementedUserLibServer) DocRecycle(context.Context, *UserRecoveryRequest) (*UserCollectResponse, error) {
-	return nil, status.Errorf(codes.Unimplemented, "method DocRecycle not implemented")
+func (*UnimplementedUserLibServer) DocPermanentDelete(context.Context, *UserRecoveryRequest) (*UserCollectResponse, error) {
+	return nil, status.Errorf(codes.Unimplemented, "method DocPermanentDelete not implemented")
 }
 
 func RegisterUserLibServer(s *grpc.Server, srv UserLibServer) {
@@ -1168,7 +1137,7 @@ func _UserLib_DocCancelCollect_Handler(srv interface{}, ctx context.Context, dec
 }
 
 func _UserLib_DocDelete_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
-	in := new(UserDeleteRequest)
+	in := new(UserRecoveryRequest)
 	if err := dec(in); err != nil {
 		return nil, err
 	}
@@ -1180,13 +1149,13 @@ func _UserLib_DocDelete_Handler(srv interface{}, ctx context.Context, dec func(i
 		FullMethod: "/userlib.UserLib/DocDelete",
 	}
 	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
-		return srv.(UserLibServer).DocDelete(ctx, req.(*UserDeleteRequest))
+		return srv.(UserLibServer).DocDelete(ctx, req.(*UserRecoveryRequest))
 	}
 	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)
+	in := new(UserRecoveryRequest)
 	if err := dec(in); err != nil {
 		return nil, err
 	}
@@ -1198,7 +1167,7 @@ func _UserLib_DocRestore_Handler(srv interface{}, ctx context.Context, dec func(
 		FullMethod: "/userlib.UserLib/DocRestore",
 	}
 	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
-		return srv.(UserLibServer).DocRestore(ctx, req.(*UserRestoreRequest))
+		return srv.(UserLibServer).DocRestore(ctx, req.(*UserRecoveryRequest))
 	}
 	return interceptor(ctx, in, info, handler)
 }
@@ -1221,20 +1190,20 @@ func _UserLib_DocDownload_Handler(srv interface{}, ctx context.Context, dec func
 	return interceptor(ctx, in, info, handler)
 }
 
-func _UserLib_DocRecycle_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+func _UserLib_DocPermanentDelete_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
 	in := new(UserRecoveryRequest)
 	if err := dec(in); err != nil {
 		return nil, err
 	}
 	if interceptor == nil {
-		return srv.(UserLibServer).DocRecycle(ctx, in)
+		return srv.(UserLibServer).DocPermanentDelete(ctx, in)
 	}
 	info := &grpc.UnaryServerInfo{
 		Server:     srv,
-		FullMethod: "/userlib.UserLib/DocRecycle",
+		FullMethod: "/userlib.UserLib/DocPermanentDelete",
 	}
 	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
-		return srv.(UserLibServer).DocRecycle(ctx, req.(*UserRecoveryRequest))
+		return srv.(UserLibServer).DocPermanentDelete(ctx, req.(*UserRecoveryRequest))
 	}
 	return interceptor(ctx, in, info, handler)
 }
@@ -1268,8 +1237,8 @@ var _UserLib_serviceDesc = grpc.ServiceDesc{
 			Handler:    _UserLib_DocDownload_Handler,
 		},
 		{
-			MethodName: "DocRecycle",
-			Handler:    _UserLib_DocRecycle_Handler,
+			MethodName: "DocPermanentDelete",
+			Handler:    _UserLib_DocPermanentDelete_Handler,
 		},
 	},
 	Streams:  []grpc.StreamDesc{},

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

@@ -14,24 +14,24 @@ import (
 )
 
 type (
-	UserDeleteResponse  = userlib.UserDeleteResponse
-	UserRestoreRequest  = userlib.UserRestoreRequest
-	UserDocsRequest     = userlib.UserDocsRequest
-	UserDocsResponse    = userlib.UserDocsResponse
-	UserRecoveryRequest = userlib.UserRecoveryRequest
 	UserCollectRequest  = userlib.UserCollectRequest
 	UserCollectResponse = userlib.UserCollectResponse
 	UserDeleteRequest   = userlib.UserDeleteRequest
+	UserDeleteResponse  = userlib.UserDeleteResponse
+	UserDocsRequest     = userlib.UserDocsRequest
+	UserRestoreRequest  = userlib.UserRestoreRequest
 	UserRestoreResponse = userlib.UserRestoreResponse
+	UserDocsResponse    = userlib.UserDocsResponse
+	UserRecoveryRequest = userlib.UserRecoveryRequest
 
 	UserLib interface {
 		UserDocs(ctx context.Context, in *UserDocsRequest) (*UserDocsResponse, error)
 		DocCollect(ctx context.Context, in *UserCollectRequest) (*UserCollectResponse, error)
 		DocCancelCollect(ctx context.Context, in *UserDeleteRequest) (*UserDeleteResponse, error)
-		DocDelete(ctx context.Context, in *UserDeleteRequest) (*UserDeleteResponse, error)
-		DocRestore(ctx context.Context, in *UserRestoreRequest) (*UserRestoreResponse, error)
+		DocDelete(ctx context.Context, in *UserRecoveryRequest) (*UserDeleteResponse, error)
+		DocRestore(ctx context.Context, in *UserRecoveryRequest) (*UserRestoreResponse, error)
 		DocDownload(ctx context.Context, in *UserCollectRequest) (*UserCollectResponse, error)
-		DocRecycle(ctx context.Context, in *UserRecoveryRequest) (*UserCollectResponse, error)
+		DocPermanentDelete(ctx context.Context, in *UserRecoveryRequest) (*UserCollectResponse, error)
 	}
 
 	defaultUserLib struct {
@@ -60,12 +60,12 @@ func (m *defaultUserLib) DocCancelCollect(ctx context.Context, in *UserDeleteReq
 	return client.DocCancelCollect(ctx, in)
 }
 
-func (m *defaultUserLib) DocDelete(ctx context.Context, in *UserDeleteRequest) (*UserDeleteResponse, error) {
+func (m *defaultUserLib) DocDelete(ctx context.Context, in *UserRecoveryRequest) (*UserDeleteResponse, error) {
 	client := userlib.NewUserLibClient(m.cli.Conn())
 	return client.DocDelete(ctx, in)
 }
 
-func (m *defaultUserLib) DocRestore(ctx context.Context, in *UserRestoreRequest) (*UserRestoreResponse, error) {
+func (m *defaultUserLib) DocRestore(ctx context.Context, in *UserRecoveryRequest) (*UserRestoreResponse, error) {
 	client := userlib.NewUserLibClient(m.cli.Conn())
 	return client.DocRestore(ctx, in)
 }
@@ -75,7 +75,7 @@ func (m *defaultUserLib) DocDownload(ctx context.Context, in *UserCollectRequest
 	return client.DocDownload(ctx, in)
 }
 
-func (m *defaultUserLib) DocRecycle(ctx context.Context, in *UserRecoveryRequest) (*UserCollectResponse, error) {
+func (m *defaultUserLib) DocPermanentDelete(ctx context.Context, in *UserRecoveryRequest) (*UserCollectResponse, error) {
 	client := userlib.NewUserLibClient(m.cli.Conn())
-	return client.DocRecycle(ctx, in)
+	return client.DocPermanentDelete(ctx, in)
 }

+ 3 - 0
services/model/stdlib.go

@@ -48,6 +48,9 @@ type UserDoc struct {
 	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"`
+	IsDownload     int       `json:"is_download" gorm:"column:isDownload"`
+	IsCollection     int       `json:"is_collection" gorm:"column:isCollection"`
+
 }
 
 func (ud *UserDoc) TableName() string {

+ 47 - 15
services/userlib/userDocService.go

@@ -198,13 +198,13 @@ func UserDocDownload(userDoc *model.UserDoc, cost int,hosts []string,key string)
 			err0 := docRpcUtil.GetJyDocsDB().
 				Where("id = ?",userDoc.DocId).
 				Find(&doc)
-			if err0 != nil {
+			if err0.Error != nil {
 				log.Println("文档不存在")
 				msg="文档不存在"
 				return errors.New("文档不存在")
 			}
 			userDoc.DocSourceUserId = doc.UserId
-			userDoc.DocCategory = doc.DocFileType
+			userDoc.DocCategory = model.UserDocCategory_Download
 			userDoc.IsDelete = int(userlib.UserDocStatus_Normal)
 			userDoc.DocName = doc.DocName
 			userDoc.DocFileSuffix = doc.DocFileSuffix
@@ -234,32 +234,64 @@ func UserDocDownload(userDoc *model.UserDoc, cost int,hosts []string,key string)
 	}
 	return true,msg
 }
-func UserDocDelete(docId string) bool {
+//文档删除
+func UserDocDelete(userDocId int32)  (bool,string){
+	msg:="文档删除成功"
 	err := docRpcUtil.GetJyDocsDB().Transaction(func(tx *gorm.DB) error {
-		orm := docRpcUtil.GetJyDocsDB()
-		docData := model.UserDoc{}
-		//查询用户文档详情
-		orm.Select("userId,docId").First(&docData, docId)
-		log.Println(docData.UserId)
-		log.Println(docData.DocId)
+		//逻辑删除
+		err := docRpcUtil.GetJyDocsDB().Exec("UPDATE user_doc SET isDelete = ? WHERE id = ?", model.UserDocStatus_LogicDelete,userDocId).Error
+		if err != nil {
+			msg="文档删除失败"
+			log.Println("文档删除失败:", err)
+			tx.Rollback()
+			return err
+		}
+		//删除记录新增
 
+		return nil
+	})
+	if err != nil {
+		return false,msg
+	}
+	return true,msg
+
+}
+//文档回收
+func UserDocRestore(userDocId int32) (bool,string) {
+	msg:="文档找回成功"
+	err := docRpcUtil.GetJyDocsDB().Transaction(func(tx *gorm.DB) error {
 		//逻辑删除
-		err := docRpcUtil.GetJyDocsDB().Exec("UPDATE user_doc SET isDelete = 1 WHERE id = ?", docId).Error
+		err := docRpcUtil.GetJyDocsDB().Exec("UPDATE user_doc SET isDelete = ? WHERE id = ?",model.UserDocStatus_Normal, userDocId).Error
 		if err != nil {
+			msg="文档找回失败"
+			log.Println("文档找回失败:", err)
 			tx.Rollback()
 			return err
 		}
-		//删除记录
-		err = docRpcUtil.GetJyDocsDB().Exec("insert into del_record (docId, userId, date, operate, viewType, source, shareUserId) values (?,?,?,?,?,?,?)", docId, docData.UserId, time.Now(), 1, 1, 1, 1).Error
+		return nil
+	})
+	if err != nil {
+		return false,msg
+	}
+	return true,msg
+
+}//永久删除
+func UserDocPermanentDelete(userDocId int32) (bool,string) {
+	msg:="永久删除成功"
+	err := docRpcUtil.GetJyDocsDB().Transaction(func(tx *gorm.DB) error {
+		//逻辑删除
+		err := docRpcUtil.GetJyDocsDB().up("UPDATE user_doc SET isDelete = ? WHERE id = ?",model.UserDocStatus_PermanentlyDelete, userDocId).Error
 		if err != nil {
+			msg="永久删除失败"
+			log.Println("永久删除失败:", err)
 			tx.Rollback()
 			return err
 		}
 		return nil
 	})
 	if err != nil {
-		return false
+		return false,msg
 	}
-	return true
+	return true,msg
 
-}
+}

+ 0 - 1
services/util/baseInit.go

@@ -7,7 +7,6 @@ import (
 	"app.yhyue.com/moapp/jybase/mysql"
 	"app.yhyue.com/moapp/jyfs/rpc/filesystemclient"
 	"github.com/tal-tech/go-zero/core/discov"
-
 	"github.com/tal-tech/go-zero/zrpc"
 	"gorm.io/gorm"
 )