Bläddra i källkod

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

wangchuanjin 4 år sedan
förälder
incheckning
9afa31eaee

+ 40 - 4
rpc/userlib/internal/logic/userdocslogic.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,44 @@ func NewUserDocsLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UserDocs
 	}
 }
 
+//我的文档 收藏和兑换
 func (l *UserDocsLogic) UserDocs(in *userlib.UserDocsRequest) (*userlib.UserDocsResponse, error) {
 	// todo: add your logic here and delete this line
-
-	return &userlib.UserDocsResponse{}, nil
+	result := &userlib.UserDocsResponse{}
+	data, count, code, msg := userLibService.UserDocsList(in)
+	docList := []*userlib.UserDocs{}
+	for _, value := range data {
+		docList = append(docList, &userlib.UserDocs{
+			ID:              int64(value.ID),
+			CreateAt:        value.CreateAt.String(),
+			UpdateAt:        value.UpdateAt.String(),
+			DeletedAt:       value.DeletedAt.String(),
+			AppId:           value.AppId,
+			UserId:          value.UserId,
+			DocId:           value.DocId,
+			DocCategory:     int64(value.DocCategory),
+			IsDelete:        int64(value.IsDelete),
+			DocName:         value.DocName,
+			DocFileType:     int64(value.DocFileType),
+			DocFileSuffix:   value.DocFileSuffix,
+			DocFileSize:     int64(value.DocFileSize),
+			DocPageSize:     int64(value.DocPageSize),
+			DocSummary:      value.DocSummary,
+			DocSourceUserId: value.DocSourceUserId,
+			IsDownload:      int64(value.IsDownload),
+			IsCollection:    int64(value.IsCollection),
+		})
+	}
+	if code {
+		result.Code = 1
+		result.Message = msg
+		result.Data = docList
+		result.Count = count
+		return result, nil
+	}
+	result.Code = 0
+	result.Message = msg
+	result.Data = docList
+	result.Count = count
+	return result, nil
 }

+ 23 - 2
rpc/userlib/test/userLib_test.go

@@ -56,7 +56,7 @@ func Test_UserDocDelete(t *testing.T)  {
 	})
 	userLib := userlibclient.NewUserLib(client)
 	resp, err := userLib.DocDelete(context.Background(), &userlibclient.UserRecoveryRequest{
-		UserDocId: int32(10),
+		UserDocId: int32(13),
 		AppId:int64(10000),
 	})
 	if err != nil {
@@ -100,6 +100,27 @@ func Test_UserDocPermanentDelete(t *testing.T)  {
 	}
 	log.Print("UserDoc Collect call response:", resp)
 }
+//我的文库0兑换的 1收藏的 2回收站的
+func Test_UserDocList(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.UserDocs(context.Background(), &userlibclient.UserDocsRequest{
+		UserId: "wh11",
+		AppId:int64(10000),
+		PageSize:2,
+		Page:1,
+		UserDocCategory:2,
+	})
+	if err != nil {
+		log.Println("UserDoc Collect call error:", err)
+	}
+	log.Print("UserDoc Collect call response:", resp)
+}
 //用户转存单元测试
 func Test_UserDocDwnload(t *testing.T) {
 	client := zrpc.MustNewClient(zrpc.RpcClientConf{
@@ -111,7 +132,7 @@ func Test_UserDocDwnload(t *testing.T) {
 	userLib := userlibclient.NewUserLib(client)
 	resp, err := userLib.DocDownload(context.Background(), &userlibclient.UserCollectRequest{
 		DocId:        "123",
-		UserId:       "wh5",
+		UserId:       "wh11",
 		Cost:1000,
 		AppId:int64(10000),
 	})

+ 25 - 1
rpc/userlib/userlib.proto

@@ -53,12 +53,16 @@ message UserRestoreResponse {
 message UserDocsRequest {
     string userId=1;//用户id
     int64 appId=2;//剑鱼标识
-    UserDocCategory userDocCategory=3;//用户文档分类
+    int64 userDocCategory=3;//用户文档分类 0兑换的 1收藏的 2回收站的
+    int64 page = 4;
+    int64 pageSize = 5;
 }
 
 message UserDocsResponse {
     int32 code =1;    //响应代码
     string message=2; //响应消息
+    int64 count = 3;  //总数
+    repeated userDocs data=4; //列表
 }
 message UserRecoveryRequest {
     int32 userDocId =1;   //记录标识
@@ -69,6 +73,26 @@ enum UserDocStatus {
     LogicDelete =1;//删除
     PermanentlyDelete =2;//永久删除
 }
+message userDocs {
+    int64   ID=1;
+   	string  CreateAt=2;
+    string	UpdateAt=3;
+    string	DeletedAt=4;
+    int64	AppId=5;
+    string	UserId=6;
+    string	DocId=7;
+    int64 	DocCategory=8;
+    int64	    IsDelete=9;
+    string	DocName=10;
+    int64 	DocFileType=11;
+    string	DocFileSuffix=12;
+    int64	    DocFileSize=13;
+    int64	    DocPageSize=14;
+    string	DocSummary=15;
+    string 	DocSourceUserId=16;
+    int64 	IsDownload=17;
+    int64	    IsCollection=18;
+}
 service  UserLib {
     rpc UserDocs(UserDocsRequest) returns (UserDocsResponse);//用户文档列表
   	rpc DocCollect(UserCollectRequest) returns(UserCollectResponse); //文档收藏

+ 335 - 67
rpc/userlib/userlib/userlib.pb.go

@@ -534,9 +534,11 @@ type UserDocsRequest struct {
 	sizeCache     protoimpl.SizeCache
 	unknownFields protoimpl.UnknownFields
 
-	UserId          string          `protobuf:"bytes,1,opt,name=userId,proto3" json:"userId,omitempty"`                                                 //用户id
-	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"` //用户文档分类
+	UserId          string `protobuf:"bytes,1,opt,name=userId,proto3" json:"userId,omitempty"`                    //用户id
+	AppId           int64  `protobuf:"varint,2,opt,name=appId,proto3" json:"appId,omitempty"`                     //剑鱼标识
+	UserDocCategory int64  `protobuf:"varint,3,opt,name=userDocCategory,proto3" json:"userDocCategory,omitempty"` //用户文档分类 0兑换的 1收藏的 2回收站的
+	Page            int64  `protobuf:"varint,4,opt,name=page,proto3" json:"page,omitempty"`
+	PageSize        int64  `protobuf:"varint,5,opt,name=pageSize,proto3" json:"pageSize,omitempty"`
 }
 
 func (x *UserDocsRequest) Reset() {
@@ -585,11 +587,25 @@ func (x *UserDocsRequest) GetAppId() int64 {
 	return 0
 }
 
-func (x *UserDocsRequest) GetUserDocCategory() UserDocCategory {
+func (x *UserDocsRequest) GetUserDocCategory() int64 {
 	if x != nil {
 		return x.UserDocCategory
 	}
-	return UserDocCategory_SelfUpload
+	return 0
+}
+
+func (x *UserDocsRequest) GetPage() int64 {
+	if x != nil {
+		return x.Page
+	}
+	return 0
+}
+
+func (x *UserDocsRequest) GetPageSize() int64 {
+	if x != nil {
+		return x.PageSize
+	}
+	return 0
 }
 
 type UserDocsResponse struct {
@@ -597,8 +613,10 @@ type UserDocsResponse struct {
 	sizeCache     protoimpl.SizeCache
 	unknownFields protoimpl.UnknownFields
 
-	Code    int32  `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty"`      //响应代码
-	Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"` //响应消息
+	Code    int32       `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty"`      //响应代码
+	Message string      `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"` //响应消息
+	Count   int64       `protobuf:"varint,3,opt,name=count,proto3" json:"count,omitempty"`    //总数
+	Data    []*UserDocs `protobuf:"bytes,4,rep,name=data,proto3" json:"data,omitempty"`       //列表
 }
 
 func (x *UserDocsResponse) Reset() {
@@ -647,6 +665,20 @@ func (x *UserDocsResponse) GetMessage() string {
 	return ""
 }
 
+func (x *UserDocsResponse) GetCount() int64 {
+	if x != nil {
+		return x.Count
+	}
+	return 0
+}
+
+func (x *UserDocsResponse) GetData() []*UserDocs {
+	if x != nil {
+		return x.Data
+	}
+	return nil
+}
+
 type UserRecoveryRequest struct {
 	state         protoimpl.MessageState
 	sizeCache     protoimpl.SizeCache
@@ -702,6 +734,189 @@ func (x *UserRecoveryRequest) GetAppId() int64 {
 	return 0
 }
 
+type UserDocs struct {
+	state         protoimpl.MessageState
+	sizeCache     protoimpl.SizeCache
+	unknownFields protoimpl.UnknownFields
+
+	ID              int64  `protobuf:"varint,1,opt,name=ID,proto3" json:"ID,omitempty"`
+	CreateAt        string `protobuf:"bytes,2,opt,name=CreateAt,proto3" json:"CreateAt,omitempty"`
+	UpdateAt        string `protobuf:"bytes,3,opt,name=UpdateAt,proto3" json:"UpdateAt,omitempty"`
+	DeletedAt       string `protobuf:"bytes,4,opt,name=DeletedAt,proto3" json:"DeletedAt,omitempty"`
+	AppId           int64  `protobuf:"varint,5,opt,name=AppId,proto3" json:"AppId,omitempty"`
+	UserId          string `protobuf:"bytes,6,opt,name=UserId,proto3" json:"UserId,omitempty"`
+	DocId           string `protobuf:"bytes,7,opt,name=DocId,proto3" json:"DocId,omitempty"`
+	DocCategory     int64  `protobuf:"varint,8,opt,name=DocCategory,proto3" json:"DocCategory,omitempty"`
+	IsDelete        int64  `protobuf:"varint,9,opt,name=IsDelete,proto3" json:"IsDelete,omitempty"`
+	DocName         string `protobuf:"bytes,10,opt,name=DocName,proto3" json:"DocName,omitempty"`
+	DocFileType     int64  `protobuf:"varint,11,opt,name=DocFileType,proto3" json:"DocFileType,omitempty"`
+	DocFileSuffix   string `protobuf:"bytes,12,opt,name=DocFileSuffix,proto3" json:"DocFileSuffix,omitempty"`
+	DocFileSize     int64  `protobuf:"varint,13,opt,name=DocFileSize,proto3" json:"DocFileSize,omitempty"`
+	DocPageSize     int64  `protobuf:"varint,14,opt,name=DocPageSize,proto3" json:"DocPageSize,omitempty"`
+	DocSummary      string `protobuf:"bytes,15,opt,name=DocSummary,proto3" json:"DocSummary,omitempty"`
+	DocSourceUserId string `protobuf:"bytes,16,opt,name=DocSourceUserId,proto3" json:"DocSourceUserId,omitempty"`
+	IsDownload      int64  `protobuf:"varint,17,opt,name=IsDownload,proto3" json:"IsDownload,omitempty"`
+	IsCollection    int64  `protobuf:"varint,18,opt,name=IsCollection,proto3" json:"IsCollection,omitempty"`
+}
+
+func (x *UserDocs) Reset() {
+	*x = UserDocs{}
+	if protoimpl.UnsafeEnabled {
+		mi := &file_userlib_proto_msgTypes[9]
+		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+		ms.StoreMessageInfo(mi)
+	}
+}
+
+func (x *UserDocs) String() string {
+	return protoimpl.X.MessageStringOf(x)
+}
+
+func (*UserDocs) ProtoMessage() {}
+
+func (x *UserDocs) ProtoReflect() protoreflect.Message {
+	mi := &file_userlib_proto_msgTypes[9]
+	if protoimpl.UnsafeEnabled && x != nil {
+		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+		if ms.LoadMessageInfo() == nil {
+			ms.StoreMessageInfo(mi)
+		}
+		return ms
+	}
+	return mi.MessageOf(x)
+}
+
+// Deprecated: Use UserDocs.ProtoReflect.Descriptor instead.
+func (*UserDocs) Descriptor() ([]byte, []int) {
+	return file_userlib_proto_rawDescGZIP(), []int{9}
+}
+
+func (x *UserDocs) GetID() int64 {
+	if x != nil {
+		return x.ID
+	}
+	return 0
+}
+
+func (x *UserDocs) GetCreateAt() string {
+	if x != nil {
+		return x.CreateAt
+	}
+	return ""
+}
+
+func (x *UserDocs) GetUpdateAt() string {
+	if x != nil {
+		return x.UpdateAt
+	}
+	return ""
+}
+
+func (x *UserDocs) GetDeletedAt() string {
+	if x != nil {
+		return x.DeletedAt
+	}
+	return ""
+}
+
+func (x *UserDocs) GetAppId() int64 {
+	if x != nil {
+		return x.AppId
+	}
+	return 0
+}
+
+func (x *UserDocs) GetUserId() string {
+	if x != nil {
+		return x.UserId
+	}
+	return ""
+}
+
+func (x *UserDocs) GetDocId() string {
+	if x != nil {
+		return x.DocId
+	}
+	return ""
+}
+
+func (x *UserDocs) GetDocCategory() int64 {
+	if x != nil {
+		return x.DocCategory
+	}
+	return 0
+}
+
+func (x *UserDocs) GetIsDelete() int64 {
+	if x != nil {
+		return x.IsDelete
+	}
+	return 0
+}
+
+func (x *UserDocs) GetDocName() string {
+	if x != nil {
+		return x.DocName
+	}
+	return ""
+}
+
+func (x *UserDocs) GetDocFileType() int64 {
+	if x != nil {
+		return x.DocFileType
+	}
+	return 0
+}
+
+func (x *UserDocs) GetDocFileSuffix() string {
+	if x != nil {
+		return x.DocFileSuffix
+	}
+	return ""
+}
+
+func (x *UserDocs) GetDocFileSize() int64 {
+	if x != nil {
+		return x.DocFileSize
+	}
+	return 0
+}
+
+func (x *UserDocs) GetDocPageSize() int64 {
+	if x != nil {
+		return x.DocPageSize
+	}
+	return 0
+}
+
+func (x *UserDocs) GetDocSummary() string {
+	if x != nil {
+		return x.DocSummary
+	}
+	return ""
+}
+
+func (x *UserDocs) GetDocSourceUserId() string {
+	if x != nil {
+		return x.DocSourceUserId
+	}
+	return ""
+}
+
+func (x *UserDocs) GetIsDownload() int64 {
+	if x != nil {
+		return x.IsDownload
+	}
+	return 0
+}
+
+func (x *UserDocs) GetIsCollection() int64 {
+	if x != nil {
+		return x.IsCollection
+	}
+	return 0
+}
+
 var File_userlib_proto protoreflect.FileDescriptor
 
 var file_userlib_proto_rawDesc = []byte{
@@ -733,70 +948,110 @@ var file_userlib_proto_rawDesc = []byte{
 	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,
+	0x65, 0x22, 0x99, 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, 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,
+	0x70, 0x49, 0x64, 0x12, 0x28, 0x0a, 0x0f, 0x75, 0x73, 0x65, 0x72, 0x44, 0x6f, 0x63, 0x43, 0x61,
+	0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0f, 0x75, 0x73,
+	0x65, 0x72, 0x44, 0x6f, 0x63, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x12, 0x12, 0x0a,
+	0x04, 0x70, 0x61, 0x67, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x70, 0x61, 0x67,
+	0x65, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x61, 0x67, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x18, 0x05, 0x20,
+	0x01, 0x28, 0x03, 0x52, 0x08, 0x70, 0x61, 0x67, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x22, 0x7d, 0x0a,
+	0x10, 0x55, 0x73, 0x65, 0x72, 0x44, 0x6f, 0x63, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
+	0x65, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52,
+	0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65,
+	0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12,
+	0x14, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05,
+	0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x25, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x04, 0x20,
+	0x03, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x6c, 0x69, 0x62, 0x2e, 0x75, 0x73,
+	0x65, 0x72, 0x44, 0x6f, 0x63, 0x73, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x49, 0x0a, 0x13,
 	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, 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,
+	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, 0x22, 0xa6, 0x04, 0x0a, 0x08, 0x75, 0x73, 0x65, 0x72,
+	0x44, 0x6f, 0x63, 0x73, 0x12, 0x0e, 0x0a, 0x02, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03,
+	0x52, 0x02, 0x49, 0x44, 0x12, 0x1a, 0x0a, 0x08, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x41, 0x74,
+	0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x41, 0x74,
+	0x12, 0x1a, 0x0a, 0x08, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x41, 0x74, 0x18, 0x03, 0x20, 0x01,
+	0x28, 0x09, 0x52, 0x08, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x41, 0x74, 0x12, 0x1c, 0x0a, 0x09,
+	0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x41, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52,
+	0x09, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x41, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x41, 0x70,
+	0x70, 0x49, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x41, 0x70, 0x70, 0x49, 0x64,
+	0x12, 0x16, 0x0a, 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09,
+	0x52, 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x44, 0x6f, 0x63, 0x49,
+	0x64, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x44, 0x6f, 0x63, 0x49, 0x64, 0x12, 0x20,
+	0x0a, 0x0b, 0x44, 0x6f, 0x63, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x18, 0x08, 0x20,
+	0x01, 0x28, 0x03, 0x52, 0x0b, 0x44, 0x6f, 0x63, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79,
+	0x12, 0x1a, 0x0a, 0x08, 0x49, 0x73, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x18, 0x09, 0x20, 0x01,
+	0x28, 0x03, 0x52, 0x08, 0x49, 0x73, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x12, 0x18, 0x0a, 0x07,
+	0x44, 0x6f, 0x63, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x44,
+	0x6f, 0x63, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x44, 0x6f, 0x63, 0x46, 0x69, 0x6c,
+	0x65, 0x54, 0x79, 0x70, 0x65, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x44, 0x6f, 0x63,
+	0x46, 0x69, 0x6c, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x24, 0x0a, 0x0d, 0x44, 0x6f, 0x63, 0x46,
+	0x69, 0x6c, 0x65, 0x53, 0x75, 0x66, 0x66, 0x69, 0x78, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x09, 0x52,
+	0x0d, 0x44, 0x6f, 0x63, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x75, 0x66, 0x66, 0x69, 0x78, 0x12, 0x20,
+	0x0a, 0x0b, 0x44, 0x6f, 0x63, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x18, 0x0d, 0x20,
+	0x01, 0x28, 0x03, 0x52, 0x0b, 0x44, 0x6f, 0x63, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x69, 0x7a, 0x65,
+	0x12, 0x20, 0x0a, 0x0b, 0x44, 0x6f, 0x63, 0x50, 0x61, 0x67, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x18,
+	0x0e, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x44, 0x6f, 0x63, 0x50, 0x61, 0x67, 0x65, 0x53, 0x69,
+	0x7a, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x44, 0x6f, 0x63, 0x53, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79,
+	0x18, 0x0f, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x44, 0x6f, 0x63, 0x53, 0x75, 0x6d, 0x6d, 0x61,
+	0x72, 0x79, 0x12, 0x28, 0x0a, 0x0f, 0x44, 0x6f, 0x63, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x55,
+	0x73, 0x65, 0x72, 0x49, 0x64, 0x18, 0x10, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x44, 0x6f, 0x63,
+	0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x55, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x1e, 0x0a, 0x0a,
+	0x49, 0x73, 0x44, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x18, 0x11, 0x20, 0x01, 0x28, 0x03,
+	0x52, 0x0a, 0x49, 0x73, 0x44, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x12, 0x22, 0x0a, 0x0c,
+	0x49, 0x73, 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x12, 0x20, 0x01,
+	0x28, 0x03, 0x52, 0x0c, 0x49, 0x73, 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e,
+	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, 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,
+	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, 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,
+	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 (
@@ -812,7 +1067,7 @@ func file_userlib_proto_rawDescGZIP() []byte {
 }
 
 var file_userlib_proto_enumTypes = make([]protoimpl.EnumInfo, 3)
-var file_userlib_proto_msgTypes = make([]protoimpl.MessageInfo, 9)
+var file_userlib_proto_msgTypes = make([]protoimpl.MessageInfo, 10)
 var file_userlib_proto_goTypes = []interface{}{
 	(UserDocCategory)(0),        // 0: userlib.UserDocCategory
 	(UserDocFileType)(0),        // 1: userlib.UserDocFileType
@@ -826,9 +1081,10 @@ var file_userlib_proto_goTypes = []interface{}{
 	(*UserDocsRequest)(nil),     // 9: userlib.UserDocsRequest
 	(*UserDocsResponse)(nil),    // 10: userlib.UserDocsResponse
 	(*UserRecoveryRequest)(nil), // 11: userlib.UserRecoveryRequest
+	(*UserDocs)(nil),            // 12: userlib.userDocs
 }
 var file_userlib_proto_depIdxs = []int32{
-	0,  // 0: userlib.UserDocsRequest.userDocCategory:type_name -> userlib.UserDocCategory
+	12, // 0: userlib.UserDocsResponse.data:type_name -> userlib.userDocs
 	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
@@ -964,6 +1220,18 @@ func file_userlib_proto_init() {
 				return nil
 			}
 		}
+		file_userlib_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} {
+			switch v := v.(*UserDocs); i {
+			case 0:
+				return &v.state
+			case 1:
+				return &v.sizeCache
+			case 2:
+				return &v.unknownFields
+			default:
+				return nil
+			}
+		}
 	}
 	type x struct{}
 	out := protoimpl.TypeBuilder{
@@ -971,7 +1239,7 @@ func file_userlib_proto_init() {
 			GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
 			RawDescriptor: file_userlib_proto_rawDesc,
 			NumEnums:      3,
-			NumMessages:   9,
+			NumMessages:   10,
 			NumExtensions: 0,
 			NumServices:   1,
 		},

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

@@ -14,15 +14,16 @@ import (
 )
 
 type (
+	UserDocs            = userlib.UserDocs
+	UserCollectRequest  = userlib.UserCollectRequest
 	UserCollectResponse = userlib.UserCollectResponse
+	UserDeleteResponse  = userlib.UserDeleteResponse
+	UserDocsResponse    = userlib.UserDocsResponse
+	UserRecoveryRequest = userlib.UserRecoveryRequest
 	UserDeleteRequest   = userlib.UserDeleteRequest
+	UserRestoreRequest  = userlib.UserRestoreRequest
 	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)

+ 60 - 11
services/userlib/userDocService.go

@@ -115,7 +115,7 @@ func UserDocDownload(userDoc *model.UserDoc, cost int, hosts []string, key strin
 		//获取文档有关信息
 		//查询之前有无兑换记录  0和1只要有一条不能兑换,如果有未删除可以兑换
 		userDocDownloadList := []model.UserDoc{}
-		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)
+		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 = "查询兑换记录失败"
@@ -176,7 +176,7 @@ func UserDocDownload(userDoc *model.UserDoc, cost int, hosts []string, key strin
 				return err.Error
 			}
 			//用户收藏、兑换记录表添加记录
-			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)
+			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 = "兑换操作流水添加失败"
@@ -188,8 +188,8 @@ func UserDocDownload(userDoc *model.UserDoc, cost int, hosts []string, key strin
 			userDoc.CreateAt = time.Now()
 			userDoc.UpdateAt = time.Now()
 			userDoc.DeletedAt = time.Now()
-			userDoc.IsCollection=0
-			userDoc.IsDownload=1
+			userDoc.IsCollection = 0
+			userDoc.IsDownload = 1
 			//获取文件基本信息
 
 			//查询文档基础信息
@@ -218,7 +218,7 @@ func UserDocDownload(userDoc *model.UserDoc, cost int, hosts []string, key strin
 				return err.Error
 			}
 			//用户收藏、兑换记录表添加记录
-			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)
+			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 = "兑换操作流水添加失败"
@@ -235,7 +235,7 @@ func UserDocDownload(userDoc *model.UserDoc, cost int, hosts []string, key strin
 }
 
 //文档删除
-func UserDocDelete(userDocId int32,appId int64 ) (bool, string) {
+func UserDocDelete(userDocId int32, appId int64) (bool, string) {
 	msg := "文档删除成功"
 	err := docRpcUtil.GetJyDocsDB().Transaction(func(tx *gorm.DB) error {
 		//逻辑删除
@@ -253,7 +253,7 @@ func UserDocDelete(userDocId int32,appId int64 ) (bool, string) {
 		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
+		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 = "删除记录新增失败"
@@ -270,7 +270,7 @@ func UserDocDelete(userDocId int32,appId int64 ) (bool, string) {
 }
 
 //文档回收
-func UserDocRestore(userDocId int32,appId int64) (bool, string) {
+func UserDocRestore(userDocId int32, appId int64) (bool, string) {
 	msg := "文档找回成功"
 	err := docRpcUtil.GetJyDocsDB().Transaction(func(tx *gorm.DB) error {
 		//逻辑删除
@@ -287,7 +287,7 @@ func UserDocRestore(userDocId int32,appId int64) (bool, string) {
 		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
+		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 = "删除记录新增失败"
@@ -302,7 +302,7 @@ func UserDocRestore(userDocId int32,appId int64) (bool, string) {
 	return true, msg
 
 } //永久删除
-func UserDocPermanentDelete(userDocId int32,appId int64) (bool, string) {
+func UserDocPermanentDelete(userDocId int32, appId int64) (bool, string) {
 	msg := "永久删除成功"
 	err := docRpcUtil.GetJyDocsDB().Transaction(func(tx *gorm.DB) error {
 		//逻辑删除
@@ -319,7 +319,7 @@ func UserDocPermanentDelete(userDocId int32,appId int64) (bool, string) {
 		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
+		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 = "删除记录新增失败"
@@ -334,3 +334,52 @@ func UserDocPermanentDelete(userDocId int32,appId int64) (bool, string) {
 	return true, msg
 
 }
+
+//我的文库列表(包括回收站列表)0兑换的 1收藏的 2回收站的
+func UserDocsList(in *userlib.UserDocsRequest) ([]*model.UserDoc, int64, bool, string) {
+	msg := "查询成功"
+	data := []*model.UserDoc{}
+	count := int64(0)
+	startIndex := (in.Page - 1) * in.PageSize
+	err := docRpcUtil.GetJyDocsDB().Transaction(func(tx *gorm.DB) error {
+		switch in.UserDocCategory {
+		case int64(0):
+			//兑换的
+			err := docRpcUtil.GetJyDocsDB().Table("user_doc").Where(" userId=? and isDownload=1 and isDelete=?  and  appId=? ", in.UserId, model.UserDocStatus_Normal, in.AppId).Find(&data)
+			count = int64(len(data))
+			err = docRpcUtil.GetJyDocsDB().Table("user_doc").Where(" userId=? and isDownload=1 and isDelete=?  and  appId=?  limit ?,?", in.UserId, model.UserDocStatus_Normal, in.AppId, startIndex, in.PageSize).Find(&data)
+			if err.Error != nil {
+				log.Println("查询兑换记录失败:", err)
+				msg = "查询兑换记录失败"
+				return err.Error
+			}
+		case int64(1):
+			//收藏的
+			err := docRpcUtil.GetJyDocsDB().Table("user_doc").Where(" userId=? and isCollection=1   and  appId=? ", in.UserId, model.UserDocStatus_Normal, in.AppId).Find(&data)
+			count = int64(len(data))
+			err = docRpcUtil.GetJyDocsDB().Table("user_doc").Where(" userId=? and isCollection=1   and  appId=?  limit ?,?", in.UserId, model.UserDocStatus_Normal, in.AppId, startIndex, in.PageSize).Find(&data)
+			if err.Error != nil {
+				log.Println("查询收藏记录失败:", err)
+				msg = "查询收藏记录失败"
+				return err.Error
+			}
+		case int64(2):
+			//回收站
+			err := docRpcUtil.GetJyDocsDB().Table("user_doc").Where(" userId=? and   isDelete=?  and  appId=? ", in.UserId, model.UserDocStatus_LogicDelete, in.AppId).Find(&data)
+			count = int64(len(data))
+			err = docRpcUtil.GetJyDocsDB().Table("user_doc").Where(" userId=?  and  isDelete=?  and  appId=?  limit ?,?", in.UserId, model.UserDocStatus_LogicDelete, in.AppId, startIndex, in.PageSize).Find(&data)
+			if err.Error != nil {
+				log.Println("查询回收站记录失败:", err)
+				msg = "查询回收站记录失败"
+				return err.Error
+			}
+		}
+
+		return nil
+	})
+	if err != nil {
+		return data, count, false, msg
+	}
+	return data, count, true, msg
+
+}