浏览代码

Merge branch 'master' of https://app.yhyue.com/moapp/jy_docs

wangchuanjin 4 年之前
父节点
当前提交
701d4db681

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

@@ -1,5 +1,5 @@
 Name: jydocs.stdlib.rpc
-ListenOn: 127.0.0.1:8080
+ListenOn: 192.168.20.36:8080
 JyDocsMysqlDB:
   DriverName: "mysql"
   DataSourceName: "root:Topnet123@tcp(192.168.3.11:3366)/jydocs?charset=utf8mb4&parseTime=true&loc=Local"

+ 3 - 0
rpc/stdlib/internal/logic/docactivitylogic.go

@@ -2,6 +2,7 @@ package logic
 
 import (
 	"context"
+	"log"
 
 	"app.yhyue.com/moapp/jy_docs/rpc/stdlib/internal/svc"
 	"app.yhyue.com/moapp/jy_docs/rpc/stdlib/stdlib"
@@ -32,6 +33,8 @@ func (l *DocActivityLogic) DocActivity(in *stdlib.DocActivityReq) (*stdlib.DocAc
 	}
 	res, count := stdlibService.DocActivityList(int(in.PageSize), pageNum)
 	docActivityResp := &stdlib.DocActivityResp{Code: 0, Msg: "ok", Total: int32(count)}
+	log.Println("res ", res)
+	log.Println("count ", count)
 	for _, v := range res {
 		docActivityResp.Docs = append(docActivityResp.Docs, &stdlib.DocActivity{
 			DocId:      v.DocId,

+ 2 - 2
rpc/stdlib/test/doc_test.go

@@ -42,7 +42,7 @@ func Test_DocOff(t *testing.T) {
 func Test_DocActivity(t *testing.T) {
 	ctx, _ := context.WithTimeout(context.Background(), 10*time.Second)
 	std := stdlibclient.NewStdlib(zrpc.MustNewClient(zrpc.RpcClientConf{Etcd: discov.EtcdConf{Hosts: []string{"192.168.3.240:2379"}, Key: "jydocs.stdlib.rpc"}}))
-	req := &stdlib.DocActivityReq{PageNum: 0, PageSize: 10}
+	req := &stdlib.DocActivityReq{PageNum: 1, PageSize: 10}
 	res, err := std.DocActivity(ctx, req)
 	log.Println("err ", err)
 	log.Println("req ", res)
@@ -51,7 +51,7 @@ func Test_DocActivity(t *testing.T) {
 func Test_DocStatistics(t *testing.T) {
 	ctx, _ := context.WithTimeout(context.Background(), 10*time.Second)
 	std := stdlibclient.NewStdlib(zrpc.MustNewClient(zrpc.RpcClientConf{Etcd: discov.EtcdConf{Hosts: []string{"192.168.3.240:2379"}, Key: "jydocs.stdlib.rpc"}}))
-	req := &stdlib.DocStatisticsReq{DocId: "111", DocStatisticsType: 1}
+	req := &stdlib.DocStatisticsReq{DocId: "123", DocStatisticsType: 1}
 	res, err := std.DocStatistics(ctx, req)
 	log.Println("err ", err)
 	log.Println("req ", res)

+ 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,in.AppId)
+	if code {
 		result.Code = 1
-		result.Message = "删除成功"
+		result.Message = msg
 		return result,nil
 	}
 	result.Code = 0
-	result.Message = "删除失败"
+	result.Message = msg
 	return result, nil
 }

+ 4 - 3
rpc/userlib/internal/logic/docdownloadlogic.go

@@ -30,9 +30,10 @@ func NewDocDownloadLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DocDo
 func (l *DocDownloadLogic) DocDownload(in *userlib.UserCollectRequest) (*userlib.UserCollectResponse, error) {
 	b, msg := userLibService.UserDocDownload(
 		&model.UserDoc{
-			UserId:          in.UserId,
-			DocId:           in.DocId,
-		}, int(in.Cost),config.Configs.FileSystemConf.Etcd.Hosts,config.Configs.FileSystemConf.Etcd.Key)
+			UserId: in.UserId,
+			DocId:  in.DocId,
+			AppId:  in.AppId,
+		}, int(in.Cost), config.Configs.FileSystemConf.Etcd.Hosts, config.Configs.FileSystemConf.Etcd.Key)
 	log.Printf("用户文档收藏,userId:[%s],docId:[%s] 是否成功:[%v]", in.UserId, in.DocId, b)
 	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,in.AppId)
+	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,in.AppId)
+	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)
 }

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

@@ -46,17 +46,54 @@ 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),
+		AppId:int64(10000),
+	})
+	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),
+		AppId:int64(10000),
+	})
+	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),
+		AppId:int64(10000),
 	})
 	if err != nil {
 		log.Println("UserDoc Collect call error:", err)
@@ -76,6 +113,7 @@ func Test_UserDocDwnload(t *testing.T) {
 		DocId:        "123",
 		UserId:       "wh5",
 		Cost:1000,
+		AppId:int64(10000),
 	})
 	if err != nil {
 		log.Println("UserDoc Collect call error:", err)

+ 9 - 9
rpc/userlib/userlib.proto

@@ -22,6 +22,7 @@ message UserCollectRequest {
     string userId=1; //用户id
     string docId=2; //文档id
     int32 cost=3;//收藏|转存费用
+    int64 appId=4;//剑鱼标识
 }
 
 message UserCollectResponse {
@@ -32,6 +33,7 @@ message UserCollectResponse {
 //用户删除
 message UserDeleteRequest {
     string docId=1;//文档id
+    int64 appId=2;//剑鱼标识
 }
 message UserDeleteResponse {
     int32 code =1;    //响应代码
@@ -50,19 +52,17 @@ message UserRestoreResponse {
 //用户文档列表
 message UserDocsRequest {
     string userId=1;//用户id
-    UserDocCategory userDocCategory=2;//用户文档分类
+    int64 appId=2;//剑鱼标识
+    UserDocCategory userDocCategory=3;//用户文档分类
 }
 
 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;   //记录标识
+    int64 appId=2;//剑鱼标识
 }
 enum UserDocStatus {
     Normal =0;//文件正常
@@ -73,8 +73,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); //永久删除
 }

+ 161 - 155
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
@@ -196,6 +196,7 @@ type UserCollectRequest struct {
 	UserId string `protobuf:"bytes,1,opt,name=userId,proto3" json:"userId,omitempty"` //用户id
 	DocId  string `protobuf:"bytes,2,opt,name=docId,proto3" json:"docId,omitempty"`   //文档id
 	Cost   int32  `protobuf:"varint,3,opt,name=cost,proto3" json:"cost,omitempty"`    //收藏|转存费用
+	AppId  int64  `protobuf:"varint,4,opt,name=appId,proto3" json:"appId,omitempty"`  //剑鱼标识
 }
 
 func (x *UserCollectRequest) Reset() {
@@ -251,6 +252,13 @@ func (x *UserCollectRequest) GetCost() int32 {
 	return 0
 }
 
+func (x *UserCollectRequest) GetAppId() int64 {
+	if x != nil {
+		return x.AppId
+	}
+	return 0
+}
+
 type UserCollectResponse struct {
 	state         protoimpl.MessageState
 	sizeCache     protoimpl.SizeCache
@@ -312,7 +320,8 @@ type UserDeleteRequest struct {
 	sizeCache     protoimpl.SizeCache
 	unknownFields protoimpl.UnknownFields
 
-	DocId string `protobuf:"bytes,1,opt,name=docId,proto3" json:"docId,omitempty"` //文档id
+	DocId string `protobuf:"bytes,1,opt,name=docId,proto3" json:"docId,omitempty"`  //文档id
+	AppId int64  `protobuf:"varint,2,opt,name=appId,proto3" json:"appId,omitempty"` //剑鱼标识
 }
 
 func (x *UserDeleteRequest) Reset() {
@@ -354,6 +363,13 @@ func (x *UserDeleteRequest) GetDocId() string {
 	return ""
 }
 
+func (x *UserDeleteRequest) GetAppId() int64 {
+	if x != nil {
+		return x.AppId
+	}
+	return 0
+}
+
 type UserDeleteResponse struct {
 	state         protoimpl.MessageState
 	sizeCache     protoimpl.SizeCache
@@ -519,7 +535,8 @@ type UserDocsRequest struct {
 	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"` //用户文档分类
+	AppId           int64           `protobuf:"varint,2,opt,name=appId,proto3" json:"appId,omitempty"`                                                  //剑鱼标识
+	UserDocCategory UserDocCategory `protobuf:"varint,3,opt,name=userDocCategory,proto3,enum=userlib.UserDocCategory" json:"userDocCategory,omitempty"` //用户文档分类
 }
 
 func (x *UserDocsRequest) Reset() {
@@ -561,6 +578,13 @@ func (x *UserDocsRequest) GetUserId() string {
 	return ""
 }
 
+func (x *UserDocsRequest) GetAppId() int64 {
+	if x != nil {
+		return x.AppId
+	}
+	return 0
+}
+
 func (x *UserDocsRequest) GetUserDocCategory() UserDocCategory {
 	if x != nil {
 		return x.UserDocCategory
@@ -623,16 +647,13 @@ 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"` //记录标识
+	AppId     int64 `protobuf:"varint,2,opt,name=appId,proto3" json:"appId,omitempty"`         //剑鱼标识
 }
 
 func (x *UserRecoveryRequest) Reset() {
@@ -667,129 +688,115 @@ func (*UserRecoveryRequest) Descriptor() ([]byte, []int) {
 	return file_userlib_proto_rawDescGZIP(), []int{8}
 }
 
-func (x *UserRecoveryRequest) GetUserId() string {
-	if x != nil {
-		return x.UserId
-	}
-	return ""
-}
-
-func (x *UserRecoveryRequest) GetDocId() string {
-	if x != nil {
-		return x.DocId
-	}
-	return ""
-}
-
-func (x *UserRecoveryRequest) GetId() string {
+func (x *UserRecoveryRequest) GetUserDocId() int32 {
 	if x != nil {
-		return x.Id
+		return x.UserDocId
 	}
-	return ""
+	return 0
 }
 
-func (x *UserRecoveryRequest) GetUserDocStatus() UserDocStatus {
+func (x *UserRecoveryRequest) GetAppId() int64 {
 	if x != nil {
-		return x.UserDocStatus
+		return x.AppId
 	}
-	return UserDocStatus_Normal
+	return 0
 }
 
 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, 0x56, 0x0a, 0x12, 0x55, 0x73, 0x65, 0x72,
+	0x07, 0x75, 0x73, 0x65, 0x72, 0x6c, 0x69, 0x62, 0x22, 0x6c, 0x0a, 0x12, 0x55, 0x73, 0x65, 0x72,
 	0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x16,
 	0x0a, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06,
 	0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x64, 0x6f, 0x63, 0x49, 0x64, 0x18,
 	0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x64, 0x6f, 0x63, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04,
 	0x63, 0x6f, 0x73, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x63, 0x6f, 0x73, 0x74,
-	0x22, 0x43, 0x0a, 0x13, 0x55, 0x73, 0x65, 0x72, 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x52,
-	0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18,
-	0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x6d,
-	0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65,
-	0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x29, 0x0a, 0x11, 0x55, 0x73, 0x65, 0x72, 0x44, 0x65, 0x6c,
-	0x65, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x64, 0x6f,
-	0x63, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x64, 0x6f, 0x63, 0x49, 0x64,
-	0x22, 0x42, 0x0a, 0x12, 0x55, 0x73, 0x65, 0x72, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65,
-	0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01,
-	0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65,
-	0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73,
-	0x73, 0x61, 0x67, 0x65, 0x22, 0x2a, 0x0a, 0x12, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x73, 0x74,
-	0x6f, 0x72, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x64, 0x6f,
-	0x63, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x64, 0x6f, 0x63, 0x49, 0x64,
-	0x22, 0x43, 0x0a, 0x13, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x52,
-	0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18,
-	0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x6d,
-	0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65,
-	0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x6d, 0x0a, 0x0f, 0x55, 0x73, 0x65, 0x72, 0x44, 0x6f, 0x63,
-	0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x75, 0x73, 0x65, 0x72,
-	0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64,
-	0x12, 0x42, 0x0a, 0x0f, 0x75, 0x73, 0x65, 0x72, 0x44, 0x6f, 0x63, 0x43, 0x61, 0x74, 0x65, 0x67,
-	0x6f, 0x72, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x18, 0x2e, 0x75, 0x73, 0x65, 0x72,
-	0x6c, 0x69, 0x62, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x44, 0x6f, 0x63, 0x43, 0x61, 0x74, 0x65, 0x67,
-	0x6f, 0x72, 0x79, 0x52, 0x0f, 0x75, 0x73, 0x65, 0x72, 0x44, 0x6f, 0x63, 0x43, 0x61, 0x74, 0x65,
-	0x67, 0x6f, 0x72, 0x79, 0x22, 0x40, 0x0a, 0x10, 0x55, 0x73, 0x65, 0x72, 0x44, 0x6f, 0x63, 0x73,
-	0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65,
-	0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x18, 0x0a, 0x07,
-	0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d,
-	0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x91, 0x01, 0x0a, 0x13, 0x55, 0x73, 0x65, 0x72, 0x52,
-	0x65, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x16,
-	0x0a, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06,
-	0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x64, 0x6f, 0x63, 0x49, 0x64, 0x18,
-	0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x64, 0x6f, 0x63, 0x49, 0x64, 0x12, 0x0e, 0x0a, 0x02,
-	0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x3c, 0x0a, 0x0d,
-	0x75, 0x73, 0x65, 0x72, 0x44, 0x6f, 0x63, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x04, 0x20,
-	0x01, 0x28, 0x0e, 0x32, 0x16, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x6c, 0x69, 0x62, 0x2e, 0x55, 0x73,
-	0x65, 0x72, 0x44, 0x6f, 0x63, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x0d, 0x75, 0x73, 0x65,
-	0x72, 0x44, 0x6f, 0x63, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2a, 0x3c, 0x0a, 0x0f, 0x55, 0x73,
-	0x65, 0x72, 0x44, 0x6f, 0x63, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x12, 0x0e, 0x0a,
-	0x0a, 0x53, 0x65, 0x6c, 0x66, 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x10, 0x00, 0x12, 0x0c, 0x0a,
-	0x08, 0x44, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x10, 0x01, 0x12, 0x0b, 0x0a, 0x07, 0x43,
-	0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x10, 0x02, 0x2a, 0x4c, 0x0a, 0x0f, 0x55, 0x73, 0x65, 0x72,
-	0x44, 0x6f, 0x63, 0x46, 0x69, 0x6c, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x08, 0x0a, 0x04, 0x57,
-	0x6f, 0x72, 0x64, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, 0x50, 0x44, 0x46, 0x10, 0x01, 0x12, 0x09,
-	0x0a, 0x05, 0x45, 0x58, 0x43, 0x45, 0x4c, 0x10, 0x02, 0x12, 0x07, 0x0a, 0x03, 0x50, 0x50, 0x54,
-	0x10, 0x03, 0x12, 0x07, 0x0a, 0x03, 0x54, 0x58, 0x54, 0x10, 0x04, 0x12, 0x09, 0x0a, 0x05, 0x4f,
-	0x74, 0x68, 0x65, 0x72, 0x10, 0x05, 0x2a, 0x43, 0x0a, 0x0d, 0x55, 0x73, 0x65, 0x72, 0x44, 0x6f,
-	0x63, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x0a, 0x0a, 0x06, 0x4e, 0x6f, 0x72, 0x6d, 0x61,
-	0x6c, 0x10, 0x00, 0x12, 0x0f, 0x0a, 0x0b, 0x4c, 0x6f, 0x67, 0x69, 0x63, 0x44, 0x65, 0x6c, 0x65,
-	0x74, 0x65, 0x10, 0x01, 0x12, 0x15, 0x0a, 0x11, 0x50, 0x65, 0x72, 0x6d, 0x61, 0x6e, 0x65, 0x6e,
-	0x74, 0x6c, 0x79, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x10, 0x02, 0x32, 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,
+	0x12, 0x14, 0x0a, 0x05, 0x61, 0x70, 0x70, 0x49, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52,
+	0x05, 0x61, 0x70, 0x70, 0x49, 0x64, 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, 0x3f, 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, 0x12, 0x14, 0x0a, 0x05, 0x61, 0x70, 0x70, 0x49, 0x64, 0x18,
+	0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x61, 0x70, 0x70, 0x49, 0x64, 0x22, 0x42, 0x0a, 0x12,
+	0x55, 0x73, 0x65, 0x72, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
+	0x73, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05,
+	0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67,
+	0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65,
+	0x22, 0x2a, 0x0a, 0x12, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x52,
+	0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x64, 0x6f, 0x63, 0x49, 0x64, 0x18,
+	0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x64, 0x6f, 0x63, 0x49, 0x64, 0x22, 0x43, 0x0a, 0x13,
+	0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f,
+	0x6e, 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28,
+	0x05, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61,
+	0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67,
+	0x65, 0x22, 0x83, 0x01, 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, 0x14, 0x0a,
+	0x05, 0x61, 0x70, 0x70, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x61, 0x70,
+	0x70, 0x49, 0x64, 0x12, 0x42, 0x0a, 0x0f, 0x75, 0x73, 0x65, 0x72, 0x44, 0x6f, 0x63, 0x43, 0x61,
+	0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x18, 0x2e, 0x75,
+	0x73, 0x65, 0x72, 0x6c, 0x69, 0x62, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x44, 0x6f, 0x63, 0x43, 0x61,
+	0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x52, 0x0f, 0x75, 0x73, 0x65, 0x72, 0x44, 0x6f, 0x63, 0x43,
+	0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x22, 0x40, 0x0a, 0x10, 0x55, 0x73, 0x65, 0x72, 0x44,
+	0x6f, 0x63, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x63,
+	0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12,
+	0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09,
+	0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x49, 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, 0x12, 0x14,
+	0x0a, 0x05, 0x61, 0x70, 0x70, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x61,
+	0x70, 0x70, 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, 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,
+	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, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1b, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x6c, 0x69,
-	0x62, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70,
-	0x6f, 0x6e, 0x73, 0x65, 0x12, 0x47, 0x0a, 0x0a, 0x44, 0x6f, 0x63, 0x52, 0x65, 0x73, 0x74, 0x6f,
-	0x72, 0x65, 0x12, 0x1b, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x6c, 0x69, 0x62, 0x2e, 0x55, 0x73, 0x65,
-	0x72, 0x52, 0x65, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a,
-	0x1c, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x6c, 0x69, 0x62, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65,
-	0x73, 0x74, 0x6f, 0x72, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x48, 0x0a,
-	0x0b, 0x44, 0x6f, 0x63, 0x44, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x12, 0x1b, 0x2e, 0x75,
-	0x73, 0x65, 0x72, 0x6c, 0x69, 0x62, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x43, 0x6f, 0x6c, 0x6c, 0x65,
-	0x63, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x75, 0x73, 0x65, 0x72,
-	0x6c, 0x69, 0x62, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x52,
-	0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x48, 0x0a, 0x0a, 0x44, 0x6f, 0x63, 0x52, 0x65,
-	0x63, 0x79, 0x63, 0x6c, 0x65, 0x12, 0x1c, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x6c, 0x69, 0x62, 0x2e,
+	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, 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, 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, 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, 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 +829,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 +1001,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 +1042,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 +1051,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 +1069,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 +1083,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 +1102,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 +1174,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 +1186,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 +1204,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 +1227,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 +1274,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{},

+ 13 - 13
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
 	UserRestoreResponse = userlib.UserRestoreResponse
+	UserDocsRequest     = userlib.UserDocsRequest
+	UserDocsResponse    = userlib.UserDocsResponse
+	UserCollectRequest  = userlib.UserCollectRequest
+	UserDeleteResponse  = userlib.UserDeleteResponse
+	UserRestoreRequest  = userlib.UserRestoreRequest
+	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)
 }

+ 35 - 30
services/model/stdlib.go

@@ -5,29 +5,30 @@ import (
 )
 
 type Doc struct {
-	Id               string    `json:"id" gorm:"id"`
-	UserId           string    `json:"userId" gorm:"column:userId"`
-	DocName          string    `json:"docName" gorm:"column:docName"`
-	DocFileType      int       `json:"docFileType" gorm:"column:docFileType"`
-	DocFileSuffix    string    `json:"docFileSuffix" gorm:"column:docFileSuffix"`
-	DocFileSize      int       `json:"docFileSize" gorm:"column:docFileSize"`
-	DocPageSize      int       `json:"docPageSize" gorm:"column:docPageSize"`
-	DocTags          string    `json:"docTags" gorm:"column:docTags"`
-	DocClassLevelOne string    `json:"docClassLevelOne" gorm:"column:docClassLevelOne"`
-	DocClassLevelTwo string    `json:"docClassLevelTwo" gorm:"column:docClassLevelTwo"`
-	UploadDate       string    `json:"uploadDate" gorm:"column:uploadDate"`
-	IsDelete         int       `json:"isDelete" gorm:"column:isDelete"`
-	OssDocId         string    `json:"ossDocId" gorm:"column:ossDocId"`
-	OssDocUrl        string    `json:"ossDocUrl" gorm:"column:ossDocUrl"`
-	Md5              string    `json:"md5" gorm:"column:md5"`
-	OssPdfId         string    `json:"ossPdfId" gorm:"column:ossPdfId"`
-	OssPdfUrl        string    `json:"ossPdfUrl" gorm:"column:ossPdfUrl"`
-	OssTxtId         string    `json:"ossTxtId" gorm:"column:ossTxtId"`
-	OssTxtUrl        string    `json:"ossTxtUrl" gorm:"column:ossTxtUrl"`
-	Price            int       `json:"price" gorm:"column:price"`
-	DownOrUp         int       `json:"downOrUp" gorm:"column:downOrUp"`
-	DocSummary       string    `json:"docSummary" gorm:"column:docSummary"`
+	Id               string `json:"id" gorm:"id"`
+	UserId           string `json:"userId" gorm:"column:userId"`
+	DocName          string `json:"docName" gorm:"column:docName"`
+	DocFileType      int    `json:"docFileType" gorm:"column:docFileType"`
+	DocFileSuffix    string `json:"docFileSuffix" gorm:"column:docFileSuffix"`
+	DocFileSize      int    `json:"docFileSize" gorm:"column:docFileSize"`
+	DocPageSize      int    `json:"docPageSize" gorm:"column:docPageSize"`
+	DocTags          string `json:"docTags" gorm:"column:docTags"`
+	DocClassLevelOne string `json:"docClassLevelOne" gorm:"column:docClassLevelOne"`
+	DocClassLevelTwo string `json:"docClassLevelTwo" gorm:"column:docClassLevelTwo"`
+	UploadDate       string `json:"uploadDate" gorm:"column:uploadDate"`
+	IsDelete         int    `json:"isDelete" gorm:"column:isDelete"`
+	OssDocId         string `json:"ossDocId" gorm:"column:ossDocId"`
+	OssDocUrl        string `json:"ossDocUrl" gorm:"column:ossDocUrl"`
+	Md5              string `json:"md5" gorm:"column:md5"`
+	OssPdfId         string `json:"ossPdfId" gorm:"column:ossPdfId"`
+	OssPdfUrl        string `json:"ossPdfUrl" gorm:"column:ossPdfUrl"`
+	OssTxtId         string `json:"ossTxtId" gorm:"column:ossTxtId"`
+	OssTxtUrl        string `json:"ossTxtUrl" gorm:"column:ossTxtUrl"`
+	Price            int    `json:"price" gorm:"column:price"`
+	DownOrUp         int    `json:"downOrUp" gorm:"column:downOrUp"`
+	DocSummary       string `json:"docSummary" gorm:"column:docSummary"`
 }
+
 func (ud *Doc) TableName() string {
 	return "doc"
 }
@@ -37,6 +38,7 @@ type UserDoc struct {
 	CreateAt        time.Time `json:"create_at" gorm:"create_at"` //标签autoCreateTime设置如果字段名字不为CreatAt时候自动插入当前时间
 	UpdateAt        time.Time `json:"update_at" gorm:"update_at"`
 	DeletedAt       time.Time `json:"delete_at" gorm:"column:delete_at"`
+	AppId           int64    `json:"app_id"  gorm:"column:appId"`
 	UserId          string    `json:"user_id"  gorm:"column:userId"`
 	DocId           string    `json:"doc_id" gorm:"column:docId"`
 	DocCategory     int       `json:"doc_category" gorm:"column:docCategory"`
@@ -48,6 +50,8 @@ 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 {
@@ -56,13 +60,14 @@ func (ud *UserDoc) TableName() string {
 
 type DocActivity struct {
 	Id         int    `json:"id" gorm:"primaryKey"`
-	DocId      string `json:"docId"`
-	ActivityId int    `json:"activityId"`
-	DocTitle   string `json:"docTitle"`
-	DocSummary string `json:"docSummary"`
-	DocImg     string `json:"docImg"`
-	Price      int    `json:"price"`
-	CostPrice  int    `json:"costPrice"`
+	DocId      string `json:"doc_id" gorm:"column:docId"`
+	ActivityId int    `json:"activity_id" gorm:"column:activityId"`
+	AppId      string `json:"app_id" gorm:"column:appId"`
+	DocTitle   string `json:"doc_title" gorm:"column:docTitle"`
+	DocSummary string `json:"doc_summary" gorm:"column:docSummary"`
+	DocImg     string `json:"doc_img" gorm:"column:docImg"`
+	Price      int    `json:"price" gorm:"column:price"`
+	CostPrice  int    `json:"cost_price" gorm:"column:costPrice"`
 }
 
 func (ud *DocActivity) TableName() string {
@@ -79,4 +84,4 @@ type UserDocData struct {
 
 func (ud *UserDocData) TableName() string {
 	return "user_doc"
-}
+}

+ 6 - 2
services/stdlib/docActivity.go

@@ -1,18 +1,22 @@
 package stdlib
 
 import (
+	"log"
+
 	"app.yhyue.com/moapp/jy_docs/services/model"
 	jyDocsRpcUtil "app.yhyue.com/moapp/jy_docs/services/util"
 )
 
 func DocActivityList(pageSize, pageNum int) ([]model.DocActivity, int) {
-	docActivity := []model.DocActivity{}
+	var docActivity []model.DocActivity
+	// var docs []map[string]interface{}
 	var count int64
 	jyDocsRpcUtil.GetJyDocsDB().Model(&model.DocActivity{}).Count(&count)
 	if count > 0 {
-		jyDocsRpcUtil.GetJyDocsDB().Model(&model.DocActivity{}).Offset(pageNum * pageSize).Limit(pageSize).Find(&docActivity)
+		jyDocsRpcUtil.GetJyDocsDB().Offset((pageNum - 1) * pageSize).Limit(pageSize).Find(&docActivity)
 	} else {
 		count = 0
 	}
+	log.Println("docActivity ", docActivity)
 	return docActivity, int(count)
 }

+ 1 - 1
services/stdlib/docStatistics.go

@@ -19,7 +19,7 @@ func DocStatistics(docId string, dtype int) bool {
 	log.Println("sql ", sqlStr)
 	updateDate := time.Now().Format("2006-01-02 15:04:05")
 	err := jyDocsRpcUtil.GetJyDocsDB().Exec(sqlStr, updateDate, docId).Error
-	if err != nil {
+	if err == nil {
 		state = true
 	}
 	return state

+ 135 - 66
services/userlib/userDocService.go

@@ -1,15 +1,10 @@
 package userlib
 
 import (
-	"app.yhyue.com/moapp/jyPoints/rpc/integral"
-	"app.yhyue.com/moapp/jyPoints/rpc/integralclient"
 	"app.yhyue.com/moapp/jy_docs/rpc/userlib/userlib"
 	"app.yhyue.com/moapp/jy_docs/services/model"
 	docRpcUtil "app.yhyue.com/moapp/jy_docs/services/util"
-	"context"
 	"errors"
-	"github.com/tal-tech/go-zero/core/discov"
-	"github.com/tal-tech/go-zero/zrpc"
 	"gorm.io/gorm"
 	"log"
 	"time"
@@ -22,7 +17,7 @@ func UserDocCollect(userDoc *model.UserDoc, cost int) bool {
 	docData := model.UserDocData{}
 	err := orm.Transaction(func(tx *gorm.DB) error {
 		err0 := orm.Select("id,userId,docId,docCategory,isDelete").
-			Where("userId = ? AND docId = ? AND (isDelete = 0 OR isDelete = 1)",userDoc.UserId,userDoc.DocId).
+			Where("userId = ? AND docId = ? AND (isDelete = 0 OR isDelete = 1)", userDoc.UserId, userDoc.DocId).
 			Find(&docData).Error
 		if err0 != nil {
 			log.Println("查询已存在收藏记录失败")
@@ -31,7 +26,7 @@ func UserDocCollect(userDoc *model.UserDoc, cost int) bool {
 		//已下载数据处理
 		if docData.DocCategory == 1 {
 			log.Println("该文档已下载,无法收藏")
-			return  err0
+			return err0
 		}
 
 		//已收藏数据处理
@@ -41,14 +36,14 @@ func UserDocCollect(userDoc *model.UserDoc, cost int) bool {
 		}
 		//已取消收藏,再次进行收藏
 		if docData.IsDelete == 1 && docData.UserId != "" {
-			err := orm.Exec("UPDATE user_doc SET isDelete = 0 WHERE id = ?",docData.Id).Error
+			err := orm.Exec("UPDATE user_doc SET isDelete = 0 WHERE id = ?", docData.Id).Error
 			if err != nil {
 				log.Println("文档再次收藏失败")
 				tx.Rollback()
 				return err
 			}
 			//无收藏记录,新增收藏
-		}else{
+		} else {
 			//用户文库表添加记录(需要检查是否重复)
 			timeData := time.Now()
 			userDoc.CreateAt = timeData
@@ -56,10 +51,10 @@ func UserDocCollect(userDoc *model.UserDoc, cost int) bool {
 			userDoc.DeletedAt = timeData
 			//查询文档基础信息
 			doc := model.Doc{}
-			err0 := orm.Where("id = ?",userDoc.DocId).
+			err0 := orm.Where("id = ?", userDoc.DocId).
 				Find(&doc).Error
 			if err0 != nil || doc.Id == "" {
-				log.Println("文档不存在",err0)
+				log.Println("文档不存在", err0)
 				return err0
 			}
 			userDoc.DocSourceUserId = doc.UserId
@@ -78,7 +73,7 @@ func UserDocCollect(userDoc *model.UserDoc, cost int) bool {
 				return err
 			}
 		}
-		//用户收藏、转存记录表添加记录
+		//用户收藏、兑换记录表添加记录
 		err := orm.Exec("insert into download_collection_record (docId,userId,sourceUserId,category,cost) values (?,?,?,?,?)", userDoc.DocId, userDoc.UserId, userDoc.DocSourceUserId, userDoc.DocCategory, cost).Error
 		if err != nil {
 			log.Println("userDocCollect record insert error:", err)
@@ -97,7 +92,7 @@ func UserDocCollect(userDoc *model.UserDoc, cost int) bool {
 func UserDocCancelCollect(userDocId string) bool {
 	orm := docRpcUtil.GetJyDocsDB()
 	err := orm.Transaction(func(tx *gorm.DB) error {
-		err := orm.Exec("UPDATE user_doc SET isDelete = 1 WHERE id = ? AND docCategory = 2 AND isDelete = 0",userDocId).Error
+		err := orm.Exec("UPDATE user_doc SET isDelete = 1 WHERE id = ? AND docCategory = 2 AND isDelete = 0", userDocId).Error
 		if err != nil {
 			log.Println("文档取消收藏失败")
 			tx.Rollback()
@@ -111,30 +106,31 @@ func UserDocCancelCollect(userDocId string) bool {
 	return true
 }
 
-//转存操作
-func UserDocDownload(userDoc *model.UserDoc, cost int,hosts []string,key string) (bool,string) {
+//兑换操作
+func UserDocDownload(userDoc *model.UserDoc, cost int, hosts []string, key string) (bool, string) {
 	log.Println("UserDocCollect exec ......")
-	msg:="转存成功"
+	msg := "兑换成功"
 	err := docRpcUtil.GetJyDocsDB().Transaction(func(tx *gorm.DB) error {
 		//用户文库表添加记录
 		//获取文档有关信息
-		//查询之前有无下载记录  0和1只要有一条不能下载,如果有未删除可以下载
+		//查询之前有无兑换记录  0和1只要有一条不能兑换,如果有未删除可以兑换
 		userDocDownloadList := []model.UserDoc{}
-		err := docRpcUtil.GetJyDocsDB().Table("user_doc").Where(" userId=? and docId=? and docCategory=? and (isDelete=? or isDelete=?)", userDoc.UserId, userDoc.DocId, model.UserDocCategory_Download, model.UserDocStatus_Normal, model.UserDocStatus_LogicDelete).Find(&userDocDownloadList)
+		err := docRpcUtil.GetJyDocsDB().Table("user_doc").Where(" userId=? and docId=? and isDownload=1 and (isDelete=? or isDelete=?)  and  appId=?", userDoc.UserId, userDoc.DocId, model.UserDocStatus_Normal, model.UserDocStatus_LogicDelete,userDoc.AppId).Find(&userDocDownloadList)
 		if err.Error != nil {
-			log.Println("查询转存记录失败:",err)
-			msg="查询转存记录失败"
+			log.Println("查询兑换记录失败:", err)
+			msg = "查询兑换记录失败"
 			return err.Error
 		}
 		if len(userDocDownloadList) > 0 {
-			msg="之前已经下载不能再次下载"
-			return errors.New("之前已经下载不能再次下载")}
+			msg = "之前已经兑换不能再次兑换"
+			return errors.New("之前已经兑换不能再次兑换")
+		}
 		//先扣除积分
 		//rpc
-		client := zrpc.MustNewClient(zrpc.RpcClientConf{
+		/*client := zrpc.MustNewClient(zrpc.RpcClientConf{
 			Etcd: discov.EtcdConf{
 				Hosts: hosts,
-				Key:  key,
+				Key:   key,
 			},
 		})
 		integralLib := integralclient.NewIntegral(client)
@@ -143,47 +139,47 @@ func UserDocDownload(userDoc *model.UserDoc, cost int,hosts []string,key string)
 			BusinessTypeId: 1,
 			BusinessType:   "1",
 			Point:          int64(cost),
-			AppId:          10000}
+			AppId:          userDoc.AppId}
 		res, pointsErr := integralLib.IntegralConsume(context.Background(), req)
 		log.Println("err ", pointsErr)
 		log.Println("req ", res)
-		if (pointsErr != nil ) {
-			log.Println("扣除积分失败:",pointsErr)
-			msg="扣除积分失败"
+		if (pointsErr != nil) {
+			log.Println("扣除积分失败:", pointsErr)
+			msg = "扣除积分失败"
 			return pointsErr
 		}
 		if (res.Code == 0) {
-			log.Println("扣除积分失败:",pointsErr)
-			msg=res.Message
-			return  errors.New(res.Message)
-		}
-		//查询之前有无收藏记录 有收藏记录类型改为下载,状态改为未删除、有收藏记录插入一条新纪录
+			log.Println("扣除积分失败:", pointsErr)
+			msg = res.Message
+			return errors.New(res.Message)
+		}*/
+		//查询之前有无记录 有记录类型更新兑换,状态改为未删除、没有记录插入一条新纪录
 		userDocCollectionList := []model.UserDoc{}
-		err = docRpcUtil.GetJyDocsDB().Table("user_doc").Where(" userId=? and docId=? and docCategory=? and (isDelete=? or isDelete=?)", userDoc.UserId, userDoc.DocId, model.UserDocCategory_Collect, model.UserDocStatus_Normal, model.UserDocStatus_LogicDelete).Find(&userDocCollectionList)
+		err = docRpcUtil.GetJyDocsDB().Table("user_doc").Where(" userId=? and docId=? and  appId=? ", userDoc.UserId, userDoc.DocId, userDoc.AppId).Find(&userDocCollectionList)
 		if err.Error != nil {
-			log.Println("收藏记录查询:",err)
-			msg="收藏记录查询"
+			log.Println("收藏记录查询:", err)
+			msg = "收藏记录查询"
 			return err.Error
 		}
 		if len(userDocCollectionList) > 0 {
-			//修改收藏为下载
-			if err := tx.Exec("update user_doc set docCategory=? , isDelete=?  ,update_at=?  where  id =?", model.UserDocCategory_Download, model.UserDocStatus_Normal, time.Now(), userDocCollectionList[0].ID).Error; err != nil {
-				log.Println("收藏记录更改为转存记录失败:",err)
-				msg="收藏记录更改为转存记录失败"
+			//兑换记录修改
+			if err := tx.Exec("update user_doc set isDownload=? , isDelete=?  ,update_at=?  where  id =?", 1, model.UserDocStatus_Normal, time.Now(), userDocCollectionList[0].ID).Error; err != nil {
+				log.Println("兑换记录修改失败:", err)
+				msg = "兑换记录修改失败"
 				tx.Rollback()
 				return err
 			}
 			if err.Error != nil {
-				log.Println("转存操作流水添加失败:", err)
-				msg="收藏记录更改为转存记录失败"
+				log.Println("兑换操作流水添加失败:", err)
+				msg = "收藏记录更改为兑换记录失败"
 				tx.Rollback()
 				return err.Error
 			}
-			//用户收藏、转存记录表添加记录
-			err := docRpcUtil.GetJyDocsDB().Exec("insert into download_collection_record (docId,userId,sourceUserId,category,cost,date) values (?,?,?,?,?,?)", userDoc.DocId, userDoc.UserId, userDoc.DocSourceUserId, model.UserDocCategory_Download, cost, time.Now())
+			//用户收藏、兑换记录表添加记录
+			err := docRpcUtil.GetJyDocsDB().Exec("insert into download_collection_record (docId,userId,sourceUserId,category,cost,date,appId) values (?,?,?,?,?,?,?)", userDoc.DocId, userDoc.UserId, userDoc.DocSourceUserId, model.UserDocCategory_Download, cost, time.Now(),userDoc.AppId)
 			if err.Error != nil {
-				log.Println("转存操作流水添加失败:", err)
-				msg="转存操作流水添加失败"
+				log.Println("兑换操作流水添加失败:", err)
+				msg = "兑换操作流水添加失败"
 				tx.Rollback()
 				return err.Error
 			}
@@ -192,20 +188,21 @@ func UserDocDownload(userDoc *model.UserDoc, cost int,hosts []string,key string)
 			userDoc.CreateAt = time.Now()
 			userDoc.UpdateAt = time.Now()
 			userDoc.DeletedAt = time.Now()
+			userDoc.IsCollection=0
+			userDoc.IsDownload=1
 			//获取文件基本信息
 
 			//查询文档基础信息
 			doc := model.Doc{}
 			err0 := docRpcUtil.GetJyDocsDB().
-				Where("id = ?",userDoc.DocId).
+				Where("id = ?", userDoc.DocId).
 				Find(&doc)
-			if err0 != nil {
+			if err0.Error != nil {
 				log.Println("文档不存在")
-				msg="文档不存在"
+				msg = "文档不存在"
 				return errors.New("文档不存在")
 			}
 			userDoc.DocSourceUserId = doc.UserId
-			userDoc.DocCategory = doc.DocFileType
 			userDoc.IsDelete = int(userlib.UserDocStatus_Normal)
 			userDoc.DocName = doc.DocName
 			userDoc.DocFileType = doc.DocFileType
@@ -215,16 +212,16 @@ func UserDocDownload(userDoc *model.UserDoc, cost int,hosts []string,key string)
 			userDoc.DocSummary = doc.DocSummary
 			err = docRpcUtil.GetJyDocsDB().Create(userDoc)
 			if err.Error != nil {
-				log.Println("转存操作添加失败:", err)
-				msg="转存操作添加失败"
+				log.Println("兑换操作添加失败:", err)
+				msg = "兑换操作添加失败"
 				tx.Rollback()
 				return err.Error
 			}
-			//用户收藏、转存记录表添加记录
-			err := docRpcUtil.GetJyDocsDB().Exec("insert into download_collection_record (docId,userId,sourceUserId,category,cost,date) values (?,?,?,?,?,?)", userDoc.DocId, userDoc.UserId, userDoc.DocSourceUserId, model.UserDocCategory_Download, cost, time.Now())
+			//用户收藏、兑换记录表添加记录
+			err := docRpcUtil.GetJyDocsDB().Exec("insert into download_collection_record (docId,userId,sourceUserId,category,cost,date,appId) values (?,?,?,?,?,?,?)", userDoc.DocId, userDoc.UserId, userDoc.DocSourceUserId, model.UserDocCategory_Download, cost, time.Now(),userDoc.AppId)
 			if err.Error != nil {
-				log.Println("转存操作流水添加失败:", err)
-				msg="转存操作流水添加失败"
+				log.Println("兑换操作流水添加失败:", err)
+				msg = "兑换操作流水添加失败"
 				tx.Rollback()
 				return err.Error
 			}
@@ -232,36 +229,108 @@ func UserDocDownload(userDoc *model.UserDoc, cost int,hosts []string,key string)
 		return nil
 	})
 	if err != nil {
-		return false,msg
+		return false, msg
 	}
-	return true,msg
+	return true, msg
 }
-func UserDocDelete(docId string) bool {
+
+//文档删除
+func UserDocDelete(userDocId int32,appId int64 ) (bool, string) {
+	msg := "文档删除成功"
 	err := docRpcUtil.GetJyDocsDB().Transaction(func(tx *gorm.DB) error {
-		orm := docRpcUtil.GetJyDocsDB()
+		//逻辑删除
+		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
+		}
+
 		docData := model.UserDoc{}
 		//查询用户文档详情
-		orm.Select("userId,docId").First(&docData, docId)
+		docRpcUtil.GetJyDocsDB().Select("userId,docId").First(&docData, userDocId)
 		log.Println(docData.UserId)
 		log.Println(docData.DocId)
+		//删除记录新增
+		err = docRpcUtil.GetJyDocsDB().Exec("insert into del_record (docId, userId, date, operate, appId) values (?,?,?,?,?)",  docData.DocId,docData.UserId, time.Now(),  1, appId).Error
+		if err != nil {
+			tx.Rollback()
+			msg = "删除记录新增失败"
+			log.Println("删除记录新增失败:", err)
+			return err
+		}
+		return nil
+	})
+	if err != nil {
+		return false, msg
+	}
+	return true, msg
+
+}
 
+//文档回收
+func UserDocRestore(userDocId int32,appId int64) (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
+		docData := model.UserDoc{}
+		//查询用户文档详情
+		docRpcUtil.GetJyDocsDB().Select("userId,docId").First(&docData, userDocId)
+		log.Println(docData.UserId)
+		log.Println(docData.DocId)
+		//删除记录新增
+		err = docRpcUtil.GetJyDocsDB().Exec("insert into del_record (docId, userId, date, operate, appId) values (?,?,?,?,?)",  docData.DocId,docData.UserId, time.Now(),  2, appId).Error
 		if err != nil {
 			tx.Rollback()
+			msg = "删除记录新增失败"
+			log.Println("删除记录新增失败:", err)
 			return err
 		}
 		return nil
 	})
 	if err != nil {
-		return false
+		return false, msg
 	}
-	return true
+	return true, msg
+
+} //永久删除
+func UserDocPermanentDelete(userDocId int32,appId int64) (bool, string) {
+	msg := "永久删除成功"
+	err := docRpcUtil.GetJyDocsDB().Transaction(func(tx *gorm.DB) error {
+		//逻辑删除
+		err := docRpcUtil.GetJyDocsDB().Exec("UPDATE user_doc SET isDelete = ? ,isDownload=0 WHERE id = ?", model.UserDocStatus_PermanentlyDelete, userDocId).Error
+		if err != nil {
+			msg = "永久删除失败"
+			log.Println("永久删除失败:", err)
+			tx.Rollback()
+			return err
+		}
+		docData := model.UserDoc{}
+		//查询用户文档详情
+		docRpcUtil.GetJyDocsDB().Select("userId,docId").First(&docData, userDocId)
+		log.Println(docData.UserId)
+		log.Println(docData.DocId)
+		//删除记录新增
+		err = docRpcUtil.GetJyDocsDB().Exec("insert into del_record (docId, userId, date, operate, appId) values (?,?,?,?,?)",  docData.DocId,docData.UserId, time.Now(),4, appId).Error
+		if err != nil {
+			tx.Rollback()
+			msg = "删除记录新增失败"
+			log.Println("删除记录新增失败:", err)
+			return err
+		}
+		return nil
+	})
+	if err != nil {
+		return false, msg
+	}
+	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"
 )