Prechádzať zdrojové kódy

appid类型修改:string

李哲 4 rokov pred
rodič
commit
d23acb825b

+ 1 - 1
rpc/userlib/internal/logic/doccollectlogic.go

@@ -34,7 +34,7 @@ func (l *DocCollectLogic) DocCollect(in *userlib.UserCollectRequest) (*userlib.U
 			UserId: in.UserId,
 			DocId:  in.DocId,
 			AppId:  in.AppId,
-		}, int(in.Cost))
+		})
 	result.Code = 0
 	result.Message = "收藏失败"
 	if b {

+ 18 - 19
rpc/userlib/internal/logic/userdocslogic.go

@@ -30,26 +30,25 @@ func (l *UserDocsLogic) UserDocs(in *userlib.UserDocsRequest) (*userlib.UserDocs
 	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 value.IsDownload == 1 {
+			value.Cost = "已购买"
+		}
 
+		docList = append(docList, &userlib.UserDocs{
+			CreateAt:      value.CreateAt.Unix(),
+			UpdateAt:      value.UpdateAt.Unix(),
+			DeletedAt:     value.DeletedAt.Unix(),
+			DocId:         value.DocId,
+			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,
+			IsDownload:    int64(value.IsDownload),
+			IsCollection:  int64(value.IsCollection),
+			Cost:          value.Cost,
 		})
 	}
 	if code {

+ 21 - 20
rpc/userlib/test/userLib_test.go

@@ -19,10 +19,9 @@ func Test_UserDocCollect(t *testing.T) {
 	})
 	userLib := userlibclient.NewUserLib(client)
 	resp, err := userLib.DocCollect(context.Background(), &userlibclient.UserCollectRequest{
-		DocId:  "1",
-		UserId: "2",
-		AppId:  10000,
-		Cost:   0,
+		DocId:  "SUgJfBt1M6nop8kvwcu5",
+		UserId: "5d6378301c298a5aac7b5402",
+		AppId:  "10000",
 	})
 	if err != nil {
 		log.Println("UserDoc Collect call error:", err)
@@ -40,9 +39,9 @@ func Test_UserCancelDocCollect(t *testing.T) {
 	})
 	userLib := userlibclient.NewUserLib(client)
 	resp, err := userLib.DocCancelCollect(context.Background(), &userlibclient.UserCancelRequest{
-		DocId: "1",
-		UserId: "2",
-		AppId: 10000,
+		DocId:  "SUgJfBt1M6nop8kvwcu5",
+		UserId: "5d6378301c298a5aac7b5402",
+		AppId:  "10000",
 	})
 	if err != nil {
 		log.Println("UserDoc Collect call error:", err)
@@ -61,8 +60,8 @@ func Test_UserDocDelete(t *testing.T) {
 	userLib := userlibclient.NewUserLib(client)
 	resp, err := userLib.DocDelete(context.Background(), &userlibclient.UserRecoveryRequest{
 		UserDocId: int32(13),
-		AppId:int64(10000),
-		UserId:       "wh11",
+		AppId:     "10000",
+		UserId:    "wh11",
 	})
 	if err != nil {
 		log.Println("UserDoc Collect call error:", err)
@@ -81,8 +80,8 @@ func Test_UserDocRestore(t *testing.T) {
 	userLib := userlibclient.NewUserLib(client)
 	resp, err := userLib.DocRestore(context.Background(), &userlibclient.UserRecoveryRequest{
 		UserDocId: int32(10),
-		AppId:int64(10000),
-		UserId:       "wh11",
+		AppId:     "10000",
+		UserId:    "wh11",
 	})
 	if err != nil {
 		log.Println("UserDoc Collect call error:", err)
@@ -101,16 +100,17 @@ func Test_UserDocPermanentDelete(t *testing.T) {
 	userLib := userlibclient.NewUserLib(client)
 	resp, err := userLib.DocPermanentDelete(context.Background(), &userlibclient.UserRecoveryRequest{
 		UserDocId: int32(10),
-		AppId:int64(10000),
-		UserId:       "wh11",
+		AppId:     "10000",
+		UserId:    "wh11",
 	})
 	if err != nil {
 		log.Println("UserDoc Collect call error:", err)
 	}
 	log.Print("UserDoc Collect call response:", resp)
 }
+
 //我的文库0兑换的 1收藏的 2回收站的
-func Test_UserDocList(t *testing.T)  {
+func Test_UserDocList(t *testing.T) {
 	client := zrpc.MustNewClient(zrpc.RpcClientConf{
 		Etcd: discov.EtcdConf{
 			Hosts: []string{"127.0.0.1:2380"},
@@ -119,17 +119,18 @@ func Test_UserDocList(t *testing.T)  {
 	})
 	userLib := userlibclient.NewUserLib(client)
 	resp, err := userLib.UserDocs(context.Background(), &userlibclient.UserDocsRequest{
-		UserId: "wh11",
-		AppId:int64(10000),
-		PageSize:2,
-		Page:1,
-		UserDocCategory:2,
+		UserId:          "5d6378301c298a5aac7b5402",
+		AppId:           "10000",
+		PageSize:        10,
+		Page:            1,
+		UserDocCategory: 1,
 	})
 	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{
@@ -143,7 +144,7 @@ func Test_UserDocDwnload(t *testing.T) {
 		DocId:  "123",
 		UserId: "wh5",
 		Cost:   1000,
-		AppId:  int64(10000),
+		AppId:  "10000",
 	})
 	if err != nil {
 		log.Println("UserDoc Collect call error:", err)

+ 18 - 24
rpc/userlib/userlib.proto

@@ -22,7 +22,7 @@ message UserCollectRequest {
     string userId=1; //用户id
     string docId=2; //文档id
     int32 cost=3;//收藏|转存费用
-    int64 appId=4;//剑鱼标识
+    string appId=4;//剑鱼标识
 }
 
 message UserCollectResponse {
@@ -34,7 +34,7 @@ message UserCollectResponse {
 message UserCancelRequest {
     string docId=1;//文库ID
     string userId =2;//用户标识
-    int64 appId=3;//剑鱼标识
+    string appId=3;//剑鱼标识
 }
 message UserDeleteResponse {
     int32 code =1;    //响应代码
@@ -53,7 +53,7 @@ message UserRestoreResponse {
 //用户文档列表
 message UserDocsRequest {
     string userId=1;//用户id
-    int64 appId=2;//剑鱼标识
+    string appId=2;//剑鱼标识
     int64 userDocCategory=3;//用户文档分类 0兑换的 1收藏的 2回收站的
     int64 page = 4;
     int64 pageSize = 5;
@@ -67,7 +67,7 @@ message UserDocsResponse {
 }
 message UserRecoveryRequest {
     int32 userDocId =1;   //文档标识
-    int64 appId=2;//剑鱼标识
+    string appId=2;//剑鱼标识
     string userId=3;//用户标识
 }
 enum UserDocStatus {
@@ -76,26 +76,20 @@ enum UserDocStatus {
     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;//是否删除,0 未删除  1 已逻辑删除 2永久删除
-    string	DocName=10;//文档名
-    int64 	DocFileType=11;//文件类型,0-doc ,1-pdf ,2-xls 3 ppt 4- txt 5- 其他
-    string	DocFileSuffix=12;//文件后辍
-    int64	DocFileSize=13;//文件大小
-    int64	DocPageSize=14;//页数
-    string	DocSummary=15;//文档摘要
-    string 	DocSourceUserId=16;//文档原用户id
-    int64 	IsDownload=17;//是否转存0未转存1转存
-    int64	IsCollection=18;//是否收藏0未收藏1收藏
-    string	IsCollection=18;//是否收藏0未收藏1收藏
-
+    int64   CreateAt=1;//创建时间
+    int64	UpdateAt=2;//修改时间
+    int64	DeletedAt=3;//删除时间
+    string	DocId=4;//文档标识
+    int64	IsDelete=5;//是否删除,0 未删除  1 已逻辑删除 2永久删除
+    string	DocName=6;//文档名
+    int64 	DocFileType=7;//文件类型,0-doc ,1-pdf ,2-xls 3 ppt 4- txt 5- 其他
+    string	DocFileSuffix=8;//文件后辍
+    int64	DocFileSize=9;//文件大小
+    int64	DocPageSize=10;//页数
+    string	DocSummary=11;//文档摘要
+    int64 	IsDownload=12;//是否转存0未转存1转存
+    int64	IsCollection=13;//是否收藏0未收藏1收藏
+    string	Cost=14;//收藏|转存费用
 }
 service  UserLib {
     rpc UserDocs(UserDocsRequest) returns (UserDocsResponse);//用户文档列表

+ 110 - 149
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.1
+// 	protoc        v3.15.3
 // source: userlib.proto
 
 package userlib
@@ -196,7 +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"`  //剑鱼标识
+	AppId  string `protobuf:"bytes,4,opt,name=appId,proto3" json:"appId,omitempty"`   //剑鱼标识
 }
 
 func (x *UserCollectRequest) Reset() {
@@ -252,11 +252,11 @@ func (x *UserCollectRequest) GetCost() int32 {
 	return 0
 }
 
-func (x *UserCollectRequest) GetAppId() int64 {
+func (x *UserCollectRequest) GetAppId() string {
 	if x != nil {
 		return x.AppId
 	}
-	return 0
+	return ""
 }
 
 type UserCollectResponse struct {
@@ -322,7 +322,7 @@ type UserCancelRequest struct {
 
 	DocId  string `protobuf:"bytes,1,opt,name=docId,proto3" json:"docId,omitempty"`   //文库ID
 	UserId string `protobuf:"bytes,2,opt,name=userId,proto3" json:"userId,omitempty"` //用户标识
-	AppId  int64  `protobuf:"varint,3,opt,name=appId,proto3" json:"appId,omitempty"`  //剑鱼标识
+	AppId  string `protobuf:"bytes,3,opt,name=appId,proto3" json:"appId,omitempty"`   //剑鱼标识
 }
 
 func (x *UserCancelRequest) Reset() {
@@ -371,11 +371,11 @@ func (x *UserCancelRequest) GetUserId() string {
 	return ""
 }
 
-func (x *UserCancelRequest) GetAppId() int64 {
+func (x *UserCancelRequest) GetAppId() string {
 	if x != nil {
 		return x.AppId
 	}
-	return 0
+	return ""
 }
 
 type UserDeleteResponse struct {
@@ -543,7 +543,7 @@ type UserDocsRequest struct {
 	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"`                     //剑鱼标识
+	AppId           string `protobuf:"bytes,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"`
@@ -588,11 +588,11 @@ func (x *UserDocsRequest) GetUserId() string {
 	return ""
 }
 
-func (x *UserDocsRequest) GetAppId() int64 {
+func (x *UserDocsRequest) GetAppId() string {
 	if x != nil {
 		return x.AppId
 	}
-	return 0
+	return ""
 }
 
 func (x *UserDocsRequest) GetUserDocCategory() int64 {
@@ -693,7 +693,7 @@ type UserRecoveryRequest struct {
 	unknownFields protoimpl.UnknownFields
 
 	UserDocId int32  `protobuf:"varint,1,opt,name=userDocId,proto3" json:"userDocId,omitempty"` //文档标识
-	AppId     int64  `protobuf:"varint,2,opt,name=appId,proto3" json:"appId,omitempty"`         //剑鱼标识
+	AppId     string `protobuf:"bytes,2,opt,name=appId,proto3" json:"appId,omitempty"`          //剑鱼标识
 	UserId    string `protobuf:"bytes,3,opt,name=userId,proto3" json:"userId,omitempty"`        //用户标识
 }
 
@@ -736,11 +736,11 @@ func (x *UserRecoveryRequest) GetUserDocId() int32 {
 	return 0
 }
 
-func (x *UserRecoveryRequest) GetAppId() int64 {
+func (x *UserRecoveryRequest) GetAppId() string {
 	if x != nil {
 		return x.AppId
 	}
-	return 0
+	return ""
 }
 
 func (x *UserRecoveryRequest) GetUserId() string {
@@ -755,24 +755,20 @@ type UserDocs struct {
 	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"`               //是否删除,0 未删除  1 已逻辑删除 2永久删除
-	DocName         string `protobuf:"bytes,10,opt,name=DocName,proto3" json:"DocName,omitempty"`                 //文档名
-	DocFileType     int64  `protobuf:"varint,11,opt,name=DocFileType,proto3" json:"DocFileType,omitempty"`        //文件类型,0-doc ,1-pdf ,2-xls 3 ppt 4- txt 5- 其他
-	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"` //文档原用户id
-	IsDownload      int64  `protobuf:"varint,17,opt,name=IsDownload,proto3" json:"IsDownload,omitempty"`          //是否转存0未转存1转存
-	IsCollection    int64  `protobuf:"varint,18,opt,name=IsCollection,proto3" json:"IsCollection,omitempty"`      //是否收藏0未收藏1收藏
+	CreateAt      int64  `protobuf:"varint,1,opt,name=CreateAt,proto3" json:"CreateAt,omitempty"`          //创建时间
+	UpdateAt      int64  `protobuf:"varint,2,opt,name=UpdateAt,proto3" json:"UpdateAt,omitempty"`          //修改时间
+	DeletedAt     int64  `protobuf:"varint,3,opt,name=DeletedAt,proto3" json:"DeletedAt,omitempty"`        //删除时间
+	DocId         string `protobuf:"bytes,4,opt,name=DocId,proto3" json:"DocId,omitempty"`                 //文档标识
+	IsDelete      int64  `protobuf:"varint,5,opt,name=IsDelete,proto3" json:"IsDelete,omitempty"`          //是否删除,0 未删除  1 已逻辑删除 2永久删除
+	DocName       string `protobuf:"bytes,6,opt,name=DocName,proto3" json:"DocName,omitempty"`             //文档名
+	DocFileType   int64  `protobuf:"varint,7,opt,name=DocFileType,proto3" json:"DocFileType,omitempty"`    //文件类型,0-doc ,1-pdf ,2-xls 3 ppt 4- txt 5- 其他
+	DocFileSuffix string `protobuf:"bytes,8,opt,name=DocFileSuffix,proto3" json:"DocFileSuffix,omitempty"` //文件后辍
+	DocFileSize   int64  `protobuf:"varint,9,opt,name=DocFileSize,proto3" json:"DocFileSize,omitempty"`    //文件大小
+	DocPageSize   int64  `protobuf:"varint,10,opt,name=DocPageSize,proto3" json:"DocPageSize,omitempty"`   //页数
+	DocSummary    string `protobuf:"bytes,11,opt,name=DocSummary,proto3" json:"DocSummary,omitempty"`      //文档摘要
+	IsDownload    int64  `protobuf:"varint,12,opt,name=IsDownload,proto3" json:"IsDownload,omitempty"`     //是否转存0未转存1转存
+	IsCollection  int64  `protobuf:"varint,13,opt,name=IsCollection,proto3" json:"IsCollection,omitempty"` //是否收藏0未收藏1收藏
+	Cost          string `protobuf:"bytes,14,opt,name=Cost,proto3" json:"Cost,omitempty"`                  //收藏|转存费用
 }
 
 func (x *UserDocs) Reset() {
@@ -807,48 +803,27 @@ 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 {
+func (x *UserDocs) GetCreateAt() int64 {
 	if x != nil {
 		return x.CreateAt
 	}
-	return ""
+	return 0
 }
 
-func (x *UserDocs) GetUpdateAt() string {
+func (x *UserDocs) GetUpdateAt() int64 {
 	if x != nil {
 		return x.UpdateAt
 	}
-	return ""
+	return 0
 }
 
-func (x *UserDocs) GetDeletedAt() string {
+func (x *UserDocs) GetDeletedAt() int64 {
 	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
@@ -856,13 +831,6 @@ func (x *UserDocs) GetDocId() string {
 	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
@@ -912,13 +880,6 @@ func (x *UserDocs) GetDocSummary() string {
 	return ""
 }
 
-func (x *UserDocs) GetDocSourceUserId() string {
-	if x != nil {
-		return x.DocSourceUserId
-	}
-	return ""
-}
-
 func (x *UserDocs) GetIsDownload() int64 {
 	if x != nil {
 		return x.IsDownload
@@ -933,6 +894,13 @@ func (x *UserDocs) GetIsCollection() int64 {
 	return 0
 }
 
+func (x *UserDocs) GetCost() string {
+	if x != nil {
+		return x.Cost
+	}
+	return ""
+}
+
 var File_userlib_proto protoreflect.FileDescriptor
 
 var file_userlib_proto_rawDesc = []byte{
@@ -943,7 +911,7 @@ var file_userlib_proto_rawDesc = []byte{
 	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,
-	0x12, 0x14, 0x0a, 0x05, 0x61, 0x70, 0x70, 0x49, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52,
+	0x12, 0x14, 0x0a, 0x05, 0x61, 0x70, 0x70, 0x49, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 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,
@@ -953,7 +921,7 @@ var file_userlib_proto_rawDesc = []byte{
 	0x12, 0x14, 0x0a, 0x05, 0x64, 0x6f, 0x63, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52,
 	0x05, 0x64, 0x6f, 0x63, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64,
 	0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x14,
-	0x0a, 0x05, 0x61, 0x70, 0x70, 0x49, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x61,
+	0x0a, 0x05, 0x61, 0x70, 0x70, 0x49, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 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,
@@ -969,7 +937,7 @@ var file_userlib_proto_rawDesc = []byte{
 	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, 0x28, 0x0a, 0x0f, 0x75,
+	0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x61, 0x70, 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,
@@ -987,90 +955,83 @@ var file_userlib_proto_rawDesc = []byte{
 	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, 0x12,
+	0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x61, 0x70, 0x70, 0x49, 0x64, 0x12,
 	0x16, 0x0a, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52,
-	0x06, 0x75, 0x73, 0x65, 0x72, 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,
+	0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x22, 0xb0, 0x03, 0x0a, 0x08, 0x75, 0x73, 0x65, 0x72,
+	0x44, 0x6f, 0x63, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x41, 0x74,
+	0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x41, 0x74,
+	0x12, 0x1a, 0x0a, 0x08, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x41, 0x74, 0x18, 0x02, 0x20, 0x01,
+	0x28, 0x03, 0x52, 0x08, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x41, 0x74, 0x12, 0x1c, 0x0a, 0x09,
+	0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x41, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52,
+	0x09, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x41, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x44, 0x6f,
+	0x63, 0x49, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x44, 0x6f, 0x63, 0x49, 0x64,
+	0x12, 0x1a, 0x0a, 0x08, 0x49, 0x73, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x18, 0x05, 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,
+	0x44, 0x6f, 0x63, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x06, 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,
+	0x65, 0x54, 0x79, 0x70, 0x65, 0x18, 0x07, 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,
+	0x69, 0x6c, 0x65, 0x53, 0x75, 0x66, 0x66, 0x69, 0x78, 0x18, 0x08, 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,
+	0x0a, 0x0b, 0x44, 0x6f, 0x63, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x18, 0x09, 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,
+	0x0a, 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, 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, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c,
-	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, 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,
+	0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x44, 0x6f, 0x63, 0x53, 0x75, 0x6d, 0x6d, 0x61,
+	0x72, 0x79, 0x12, 0x1e, 0x0a, 0x0a, 0x49, 0x73, 0x44, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64,
+	0x18, 0x0c, 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, 0x0d, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0c, 0x49, 0x73, 0x43, 0x6f, 0x6c, 0x6c,
+	0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x43, 0x6f, 0x73, 0x74, 0x18, 0x0e,
+	0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x43, 0x6f, 0x73, 0x74, 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, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 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,
-	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,
+	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 (

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

@@ -14,16 +14,16 @@ import (
 )
 
 type (
+	UserDocs            = userlib.UserDocs
+	UserCollectResponse = userlib.UserCollectResponse
 	UserCancelRequest   = userlib.UserCancelRequest
-	UserDeleteResponse  = userlib.UserDeleteResponse
 	UserRestoreRequest  = userlib.UserRestoreRequest
 	UserRestoreResponse = userlib.UserRestoreResponse
+	UserRecoveryRequest = userlib.UserRecoveryRequest
+	UserCollectRequest  = userlib.UserCollectRequest
+	UserDeleteResponse  = userlib.UserDeleteResponse
 	UserDocsRequest     = userlib.UserDocsRequest
 	UserDocsResponse    = userlib.UserDocsResponse
-	UserCollectRequest  = userlib.UserCollectRequest
-	UserCollectResponse = userlib.UserCollectResponse
-	UserDocs            = userlib.UserDocs
-	UserRecoveryRequest = userlib.UserRecoveryRequest
 
 	UserLib interface {
 		UserDocs(ctx context.Context, in *UserDocsRequest) (*UserDocsResponse, error)

+ 2 - 1
services/model/stdlib.go

@@ -40,7 +40,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"`
+	AppId           string    `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"`
@@ -56,6 +56,7 @@ type UserDoc struct {
 	IsCollection    int       `json:"is_collection" gorm:"column:isCollection"`
 	PreviewImgId    string    `json:"preview_img_id" gorm:"column:previewImgId"`
 	PreviewImgUrl   string    `json:"preview_img_url" gorm:"column:previewImgUrl"`
+	Cost            string    `json:"cost" gorm:"column:cost"`
 }
 
 func (ud *UserDoc) TableName() string {

+ 14 - 12
services/userlib/userDocService.go

@@ -5,13 +5,14 @@ import (
 	"app.yhyue.com/moapp/jy_docs/services/model"
 	docRpcUtil "app.yhyue.com/moapp/jy_docs/services/util"
 	"errors"
+	"fmt"
 	"gorm.io/gorm"
 	"log"
 	"time"
 )
 
 //文档收藏
-func UserDocCollect(userDoc *model.UserDoc, cost int) bool {
+func UserDocCollect(userDoc *model.UserDoc) bool {
 	log.Println("UserDocCollect exec ......")
 	orm := docRpcUtil.GetJyDocsDB()
 	docData := model.UserDocData{}
@@ -21,20 +22,20 @@ func UserDocCollect(userDoc *model.UserDoc, cost int) bool {
 			Find(&docData).Error
 		if err0 != nil {
 			log.Println("查询已存在收藏记录失败")
-			return err0
+			return errors.New("查询已存在收藏记录失败")
 		}
 		//已收藏数据处理
 		if docData.IsCollection == 1 {
 			log.Println("此文档,该用户已收藏,不可重复收藏")
-			return err0
+			return errors.New("此文档,该用户已收藏,不可重复收藏")
 		}
 		//查询文档基础信息
 		doc := model.Doc{}
 		err0 = orm.Where("id = ?", userDoc.DocId).
 			Find(&doc).Error
 		if err0 != nil || doc.Id == "" {
-			log.Println("文档不存在", err0)
-			return err0
+			log.Println("文档不存在")
+			return errors.New("文档不存在")
 		}
 		userDoc.DocSourceUserId = doc.UserId
 		userDoc.DocCategory = 2
@@ -46,6 +47,7 @@ func UserDocCollect(userDoc *model.UserDoc, cost int) bool {
 		userDoc.DocPageSize = doc.DocPageSize
 		userDoc.DocSummary = doc.DocSummary
 		userDoc.IsCollection = 1
+		userDoc.Cost = fmt.Sprint(doc.Price)
 		//已取消收藏,再次进行收藏
 		if docData.IsCollection == 0 && docData.UserId != "" {
 			err := orm.Exec("UPDATE user_doc SET isCollection = 1 WHERE id = ?", docData.Id).Error
@@ -69,7 +71,7 @@ func UserDocCollect(userDoc *model.UserDoc, cost int) bool {
 			}
 		}
 		//用户收藏、兑换记录表添加记录
-		err := orm.Exec("insert into download_collection_record (docId,userId,appId,sourceUserId,category,cost) values (?,?,?,?,?,?)", userDoc.DocId, userDoc.UserId, userDoc.AppId, userDoc.DocSourceUserId, 2, cost).Error
+		err := orm.Exec("insert into download_collection_record (docId,userId,appId,sourceUserId,category,cost) values (?,?,?,?,?,?)", userDoc.DocId, userDoc.UserId, userDoc.AppId, userDoc.DocSourceUserId, 2, doc.Price).Error
 		if err != nil {
 			log.Println("userDocCollect record insert error:", err)
 			tx.Rollback()
@@ -84,7 +86,7 @@ func UserDocCollect(userDoc *model.UserDoc, cost int) bool {
 }
 
 //文档取消收藏
-func UserDocCancelCollect(docId, userId string,appId int64) bool {
+func UserDocCancelCollect(docId, userId,appId string) bool {
 	orm := docRpcUtil.GetJyDocsDB()
 	err := orm.Transaction(func(tx *gorm.DB) error {
 		//收藏记录详情
@@ -93,7 +95,7 @@ func UserDocCancelCollect(docId, userId string,appId int64) bool {
 			Find(&userDoc).Error
 		if err != nil || userDoc.ID == 0{
 			log.Println("无此收藏记录,取消收藏失败", err)
-			return err
+			return errors.New("无此收藏记录,取消收藏失败")
 		}
 		//文档取消收藏状态修改
 		err = orm.Exec("UPDATE user_doc SET isCollection = 0 WHERE id = ? AND isCollection = 1", userDoc.ID).Error
@@ -103,7 +105,7 @@ func UserDocCancelCollect(docId, userId string,appId int64) bool {
 			return err
 		}
 		//记录文档取消收藏添加记录
-		err = orm.Exec("insert into download_collection_record (docId,userId,appId,sourceUserId,category,cost) values (?,?,?,?,?,?)", userDoc.DocId, userDoc.UserId, userDoc.AppId, userDoc.DocSourceUserId, 3, 0).Error
+		err = orm.Exec("insert into download_collection_record (docId,userId,appId,sourceUserId,category,cost) values (?,?,?,?,?,?)", userDoc.DocId, userDoc.UserId, userDoc.AppId, userDoc.DocSourceUserId, 3, userDoc.Cost).Error
 		if err != nil {
 			log.Println("userDocCollect record insert error:", err)
 			tx.Rollback()
@@ -246,7 +248,7 @@ func UserDocDownload(userDoc *model.UserDoc, cost int) (bool, string) {
 }
 
 //文档删除
-func UserDocDelete(userDocId int32, appId int64,userId string) (bool, string) {
+func UserDocDelete(userDocId int32,appId, userId string) (bool, string) {
 	msg := "文档删除成功"
 	err := docRpcUtil.GetJyDocsDB().Transaction(func(tx *gorm.DB) error {
 		//逻辑删除
@@ -275,7 +277,7 @@ func UserDocDelete(userDocId int32, appId int64,userId string) (bool, string) {
 }
 
 //文档回收
-func UserDocRestore(userDocId int32, appId int64,userId string) (bool, string) {
+func UserDocRestore(userDocId int32,appId ,userId string) (bool, string) {
 	msg := "文档找回成功"
 	err := docRpcUtil.GetJyDocsDB().Transaction(func(tx *gorm.DB) error {
 		//逻辑删除
@@ -302,7 +304,7 @@ func UserDocRestore(userDocId int32, appId int64,userId string) (bool, string) {
 	return true, msg
 
 } //永久删除
-func UserDocPermanentDelete(userDocId int32, appId int64,userId string) (bool, string) {
+func UserDocPermanentDelete(userDocId int32,appId ,userId string) (bool, string) {
 	msg := "永久删除成功"
 	err := docRpcUtil.GetJyDocsDB().Transaction(func(tx *gorm.DB) error {
 		//逻辑删除