diff --git a/README.md b/README.md index bb6db09..d0d205a 100644 --- a/README.md +++ b/README.md @@ -180,7 +180,7 @@ docker/docker-file> docker compose up -d ```dev # 上传文件 -grpcurl -d '{\"filename\": \"1a.png\", \"folder\": \"zhangsan/lisi\", \"content\": \"iVBORw0KGgoAAAANSUhEUgAAAC8AAAAhCAYAAABJLfLcAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAVhSURBVFhH7ZZpbJRFGMd/8777Lu1u6UFpC9tDCqVFDkGOgFDlLHJIQUDQGCFgpOIHvnBpqZRbBEm1FFAwFUzEKxJjKoGABDQoJIggV6jUSmi70O1BW3bb7R7jh22lLPuuQRMbTH/JZLPzzPvMM/95npkRo0aNkjykKP4dDxMdwbcXHcG3F//34AXdJqxg+wfvs+utefQP9bffRbE8zcp3d7CjYD1zU42+TqGgquq/aorwn8mHwb/jfhSEMYSwsM5oTg0dPy1omCIiidQa0QBQSZy2mrWze6B4/9l1IhQPv3++mvXfluP1s+kqryVPJ+e9AvLz81g1oycaICJG8OqWfPK357M5awRRAoQQCCEAgdJGIkVVfQuVEq+USP+GQDFoaJqGZlARBBgjJdLrH/JdhN4NqyXPYcPa6SSo/hYf9Wf38ol1LPMnxKG0ehAGjJ0MKEg8zU7qL+9n/bZjVAaYQXtkBjm5s+llBMeFQnK2HqNSN06JDOBDN3glIoG0+AgUBJ0ff46sKSlo1afYu+coVq+CdDsJG7mYJRO66aZS05V9ZG88isOSgiWs7SiF6CfmkZWRhEFW89NHuzlS5mpjv4u3oYKSiob7UoagwWtGNEUgpUr3SctYMzcNreo423I/5nIjSKkR07svSeFttiY0jWdeyqCHoZIf93/JzzfLuHjOStycDeRmJqCziUHwUF60jlWfXiPQ0nQKNpIRr21i8bDwFlWF77fraJYWjPYNaS5mf85GDl/vRs/Ien4ra0DpHsVEADzcLjnDqeJmQCOuxWuT9QqXyh2YEwfQJ06ltuRXSmo9AGixaTyW1JnG8otctjoxxfejb3df2euhW7C0FKKv/dXZpkANWCYsZ/vOLbz+8miSDCCEvjsAt/U4hXn7OFnpAbxUn/mM/Lw88vJ28vWlO0ig+foR9uQVcsLqW1QwdJSv4/SupZzfI5BSIbpfOsMSQ8FdzaWTZyhrwldEkenEPDmA/r0nMnXg9+y2BsxAHTSSn81l51RfNqtGUxAlA6MzXuJxOrDb7TgcDtwxw5g2axYzx6dgdNix2+3Y7Q4c5ac48kstUkQzZPJILDpS6OF1OXE6W5o7UEkGR3e68KFZrFk0BLOUKMZQjABR6SzJH46U4K44xDsbD3D5h7PYRo4nNnU8GX3O+LsJgovrRZtZ900ZHoykvriJN6d09x8UFB3lQSpGQs1mwsLCMBlbzgnViMlkxmw2Y+7k63MUn+TUtXKunDjGuSr3vU6CohI7agErs7PJzl7GC4MjdI9cPXSVbyo+wJacIpCCyOHzWZKZglZ9kt3bD3LDLZDuBirdgLzKF2tXICWolqlM83eki0J4fBp941v/t5xoD4Cu8q7b5ZSWllL6RynWutbKb6bulpVbNQ00q9Ekp8YR4nsBACADXYO6uLj2VQ6vLFzIwgVZbDhs5UG+Rl/5cNLGjmOgJYrIqCi6JlowAKLLUywtGIOqCkBiO1FAvisSg+Ki2duJhPQRJBoBjxdvgIeYNKUwJjOWrqE+W4hlKBmTmgEIjWlJzc5pjMtMoIv57wtY54Y1MXDR2ywf3SXIVnooP7SVD2/P5I3nU30F3YrjAoXZb/OdTQIaveb+pzesk+qKKhpdIbjqblNju8VNq5WKm7ew2WzYqqqpra2n/s4dROpQamUqca2rlE1cP17Eadv9mjRcOczBczUB3yn3ohA9aDITHzX7G+5BR3kQqgHF68YT0NqGkBh6JkUg3G5cTgf1NTXUNbrb5K+BrmmDSY02IB03OH/uBo57HATCRMKggSSZBO7qYs5erSLQOaYb/MOA7mnzMNARfHvREXx70RF8e/EnBBEDlIbPjKIAAAAASUVORK5CYII=\"}' -plaintext localhost:60200 file.File/Upload +grpcurl -d '{\"filename\": \"1a.png\", \"folder\": \"zhang san/li si\", \"bucket\": \"wallpaper\", \"content\": \"iVBORw0KGgoAAAANSUhEUgAAAC8AAAAhCAYAAABJLfLcAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAVhSURBVFhH7ZZpbJRFGMd/8777Lu1u6UFpC9tDCqVFDkGOgFDlLHJIQUDQGCFgpOIHvnBpqZRbBEm1FFAwFUzEKxJjKoGABDQoJIggV6jUSmi70O1BW3bb7R7jh22lLPuuQRMbTH/JZLPzzPvMM/95npkRo0aNkjykKP4dDxMdwbcXHcG3F//34AXdJqxg+wfvs+utefQP9bffRbE8zcp3d7CjYD1zU42+TqGgquq/aorwn8mHwb/jfhSEMYSwsM5oTg0dPy1omCIiidQa0QBQSZy2mrWze6B4/9l1IhQPv3++mvXfluP1s+kqryVPJ+e9AvLz81g1oycaICJG8OqWfPK357M5awRRAoQQCCEAgdJGIkVVfQuVEq+USP+GQDFoaJqGZlARBBgjJdLrH/JdhN4NqyXPYcPa6SSo/hYf9Wf38ol1LPMnxKG0ehAGjJ0MKEg8zU7qL+9n/bZjVAaYQXtkBjm5s+llBMeFQnK2HqNSN06JDOBDN3glIoG0+AgUBJ0ff46sKSlo1afYu+coVq+CdDsJG7mYJRO66aZS05V9ZG88isOSgiWs7SiF6CfmkZWRhEFW89NHuzlS5mpjv4u3oYKSiob7UoagwWtGNEUgpUr3SctYMzcNreo423I/5nIjSKkR07svSeFttiY0jWdeyqCHoZIf93/JzzfLuHjOStycDeRmJqCziUHwUF60jlWfXiPQ0nQKNpIRr21i8bDwFlWF77fraJYWjPYNaS5mf85GDl/vRs/Ien4ra0DpHsVEADzcLjnDqeJmQCOuxWuT9QqXyh2YEwfQJ06ltuRXSmo9AGixaTyW1JnG8otctjoxxfejb3df2euhW7C0FKKv/dXZpkANWCYsZ/vOLbz+8miSDCCEvjsAt/U4hXn7OFnpAbxUn/mM/Lw88vJ28vWlO0ig+foR9uQVcsLqW1QwdJSv4/SupZzfI5BSIbpfOsMSQ8FdzaWTZyhrwldEkenEPDmA/r0nMnXg9+y2BsxAHTSSn81l51RfNqtGUxAlA6MzXuJxOrDb7TgcDtwxw5g2axYzx6dgdNix2+3Y7Q4c5ac48kstUkQzZPJILDpS6OF1OXE6W5o7UEkGR3e68KFZrFk0BLOUKMZQjABR6SzJH46U4K44xDsbD3D5h7PYRo4nNnU8GX3O+LsJgovrRZtZ900ZHoykvriJN6d09x8UFB3lQSpGQs1mwsLCMBlbzgnViMlkxmw2Y+7k63MUn+TUtXKunDjGuSr3vU6CohI7agErs7PJzl7GC4MjdI9cPXSVbyo+wJacIpCCyOHzWZKZglZ9kt3bD3LDLZDuBirdgLzKF2tXICWolqlM83eki0J4fBp941v/t5xoD4Cu8q7b5ZSWllL6RynWutbKb6bulpVbNQ00q9Ekp8YR4nsBACADXYO6uLj2VQ6vLFzIwgVZbDhs5UG+Rl/5cNLGjmOgJYrIqCi6JlowAKLLUywtGIOqCkBiO1FAvisSg+Ki2duJhPQRJBoBjxdvgIeYNKUwJjOWrqE+W4hlKBmTmgEIjWlJzc5pjMtMoIv57wtY54Y1MXDR2ywf3SXIVnooP7SVD2/P5I3nU30F3YrjAoXZb/OdTQIaveb+pzesk+qKKhpdIbjqblNju8VNq5WKm7ew2WzYqqqpra2n/s4dROpQamUqca2rlE1cP17Eadv9mjRcOczBczUB3yn3ohA9aDITHzX7G+5BR3kQqgHF68YT0NqGkBh6JkUg3G5cTgf1NTXUNbrb5K+BrmmDSY02IB03OH/uBo57HATCRMKggSSZBO7qYs5erSLQOaYb/MOA7mnzMNARfHvREXx70RF8e/EnBBEDlIbPjKIAAAAASUVORK5CYII=\"}' -plaintext localhost:60200 file.File/Upload # 获取文件URL grpcurl -d '{\"file_id\": \"zhangsan/a24c8397-d373-4eb7-a563-b0c9c3f4591c.png\"}' -plaintext localhost:60200 file.File/GetFileUrl @@ -206,6 +206,9 @@ grpcurl -plaintext -d '{\"id\": \"d628cf35-539f-4533-a5a2-492d729ecf3b\",\"name\ # 查 grpcurl -plaintext -d '{\"id\": \"d628cf35-539f-4533-a5a2-492d729ecf3b\"}' localhost:60300 category.Category/GetCategory +# 查询某一分类的完整分类(从根分类到当前分类) +grpcurl -plaintext -d '{\"id\": \"da24a78c-ad51-4e82-8aa9-b35342f7ef30\"}' localhost:60300 category.Category/GetFullCategories + ``` ## 图库服务 diff --git a/category/category/category.pb.go b/category/category/category.pb.go index a199714..8c13c15 100644 --- a/category/category/category.pb.go +++ b/category/category/category.pb.go @@ -501,6 +501,51 @@ func (x *GetCategoryRequest) GetId() string { return "" } +// 获取全分类名称的响应 +type GetFullCategoriesResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + FullCategoryName string `protobuf:"bytes,1,opt,name=full_category_name,json=fullCategoryName,proto3" json:"full_category_name,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetFullCategoriesResponse) Reset() { + *x = GetFullCategoriesResponse{} + mi := &file_rpc_category_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetFullCategoriesResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetFullCategoriesResponse) ProtoMessage() {} + +func (x *GetFullCategoriesResponse) ProtoReflect() protoreflect.Message { + mi := &file_rpc_category_proto_msgTypes[8] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetFullCategoriesResponse.ProtoReflect.Descriptor instead. +func (*GetFullCategoriesResponse) Descriptor() ([]byte, []int) { + return file_rpc_category_proto_rawDescGZIP(), []int{8} +} + +func (x *GetFullCategoriesResponse) GetFullCategoryName() string { + if x != nil { + return x.FullCategoryName + } + return "" +} + // 分类信息响应 type CategoryInfoResponse struct { state protoimpl.MessageState `protogen:"open.v1"` @@ -511,7 +556,7 @@ type CategoryInfoResponse struct { func (x *CategoryInfoResponse) Reset() { *x = CategoryInfoResponse{} - mi := &file_rpc_category_proto_msgTypes[8] + mi := &file_rpc_category_proto_msgTypes[9] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -523,7 +568,7 @@ func (x *CategoryInfoResponse) String() string { func (*CategoryInfoResponse) ProtoMessage() {} func (x *CategoryInfoResponse) ProtoReflect() protoreflect.Message { - mi := &file_rpc_category_proto_msgTypes[8] + mi := &file_rpc_category_proto_msgTypes[9] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -536,7 +581,7 @@ func (x *CategoryInfoResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use CategoryInfoResponse.ProtoReflect.Descriptor instead. func (*CategoryInfoResponse) Descriptor() ([]byte, []int) { - return file_rpc_category_proto_rawDescGZIP(), []int{8} + return file_rpc_category_proto_rawDescGZIP(), []int{9} } func (x *CategoryInfoResponse) GetCategory() *CategoryInfo { @@ -557,7 +602,7 @@ type GetChildrenRequest struct { func (x *GetChildrenRequest) Reset() { *x = GetChildrenRequest{} - mi := &file_rpc_category_proto_msgTypes[9] + mi := &file_rpc_category_proto_msgTypes[10] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -569,7 +614,7 @@ func (x *GetChildrenRequest) String() string { func (*GetChildrenRequest) ProtoMessage() {} func (x *GetChildrenRequest) ProtoReflect() protoreflect.Message { - mi := &file_rpc_category_proto_msgTypes[9] + mi := &file_rpc_category_proto_msgTypes[10] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -582,7 +627,7 @@ func (x *GetChildrenRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use GetChildrenRequest.ProtoReflect.Descriptor instead. func (*GetChildrenRequest) Descriptor() ([]byte, []int) { - return file_rpc_category_proto_rawDescGZIP(), []int{9} + return file_rpc_category_proto_rawDescGZIP(), []int{10} } func (x *GetChildrenRequest) GetParentId() string { @@ -610,7 +655,7 @@ type GetTreeRequest struct { func (x *GetTreeRequest) Reset() { *x = GetTreeRequest{} - mi := &file_rpc_category_proto_msgTypes[10] + mi := &file_rpc_category_proto_msgTypes[11] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -622,7 +667,7 @@ func (x *GetTreeRequest) String() string { func (*GetTreeRequest) ProtoMessage() {} func (x *GetTreeRequest) ProtoReflect() protoreflect.Message { - mi := &file_rpc_category_proto_msgTypes[10] + mi := &file_rpc_category_proto_msgTypes[11] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -635,7 +680,7 @@ func (x *GetTreeRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use GetTreeRequest.ProtoReflect.Descriptor instead. func (*GetTreeRequest) Descriptor() ([]byte, []int) { - return file_rpc_category_proto_rawDescGZIP(), []int{10} + return file_rpc_category_proto_rawDescGZIP(), []int{11} } func (x *GetTreeRequest) GetSystemId() string { @@ -663,7 +708,7 @@ type MoveCategoryRequest struct { func (x *MoveCategoryRequest) Reset() { *x = MoveCategoryRequest{} - mi := &file_rpc_category_proto_msgTypes[11] + mi := &file_rpc_category_proto_msgTypes[12] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -675,7 +720,7 @@ func (x *MoveCategoryRequest) String() string { func (*MoveCategoryRequest) ProtoMessage() {} func (x *MoveCategoryRequest) ProtoReflect() protoreflect.Message { - mi := &file_rpc_category_proto_msgTypes[11] + mi := &file_rpc_category_proto_msgTypes[12] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -688,7 +733,7 @@ func (x *MoveCategoryRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use MoveCategoryRequest.ProtoReflect.Descriptor instead. func (*MoveCategoryRequest) Descriptor() ([]byte, []int) { - return file_rpc_category_proto_rawDescGZIP(), []int{11} + return file_rpc_category_proto_rawDescGZIP(), []int{12} } func (x *MoveCategoryRequest) GetId() string { @@ -715,7 +760,7 @@ type GetAncestorPathRequest struct { func (x *GetAncestorPathRequest) Reset() { *x = GetAncestorPathRequest{} - mi := &file_rpc_category_proto_msgTypes[12] + mi := &file_rpc_category_proto_msgTypes[13] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -727,7 +772,7 @@ func (x *GetAncestorPathRequest) String() string { func (*GetAncestorPathRequest) ProtoMessage() {} func (x *GetAncestorPathRequest) ProtoReflect() protoreflect.Message { - mi := &file_rpc_category_proto_msgTypes[12] + mi := &file_rpc_category_proto_msgTypes[13] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -740,7 +785,7 @@ func (x *GetAncestorPathRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use GetAncestorPathRequest.ProtoReflect.Descriptor instead. func (*GetAncestorPathRequest) Descriptor() ([]byte, []int) { - return file_rpc_category_proto_rawDescGZIP(), []int{12} + return file_rpc_category_proto_rawDescGZIP(), []int{13} } func (x *GetAncestorPathRequest) GetId() string { @@ -760,7 +805,7 @@ type CategoryPathResponse struct { func (x *CategoryPathResponse) Reset() { *x = CategoryPathResponse{} - mi := &file_rpc_category_proto_msgTypes[13] + mi := &file_rpc_category_proto_msgTypes[14] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -772,7 +817,7 @@ func (x *CategoryPathResponse) String() string { func (*CategoryPathResponse) ProtoMessage() {} func (x *CategoryPathResponse) ProtoReflect() protoreflect.Message { - mi := &file_rpc_category_proto_msgTypes[13] + mi := &file_rpc_category_proto_msgTypes[14] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -785,7 +830,7 @@ func (x *CategoryPathResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use CategoryPathResponse.ProtoReflect.Descriptor instead. func (*CategoryPathResponse) Descriptor() ([]byte, []int) { - return file_rpc_category_proto_rawDescGZIP(), []int{13} + return file_rpc_category_proto_rawDescGZIP(), []int{14} } func (x *CategoryPathResponse) GetPath() []*CategoryInfo { @@ -805,7 +850,7 @@ type BatchCreateRequest struct { func (x *BatchCreateRequest) Reset() { *x = BatchCreateRequest{} - mi := &file_rpc_category_proto_msgTypes[14] + mi := &file_rpc_category_proto_msgTypes[15] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -817,7 +862,7 @@ func (x *BatchCreateRequest) String() string { func (*BatchCreateRequest) ProtoMessage() {} func (x *BatchCreateRequest) ProtoReflect() protoreflect.Message { - mi := &file_rpc_category_proto_msgTypes[14] + mi := &file_rpc_category_proto_msgTypes[15] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -830,7 +875,7 @@ func (x *BatchCreateRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use BatchCreateRequest.ProtoReflect.Descriptor instead. func (*BatchCreateRequest) Descriptor() ([]byte, []int) { - return file_rpc_category_proto_rawDescGZIP(), []int{14} + return file_rpc_category_proto_rawDescGZIP(), []int{15} } func (x *BatchCreateRequest) GetCategories() []*CreateCategoryRequest { @@ -851,7 +896,7 @@ type BatchCreateResponse struct { func (x *BatchCreateResponse) Reset() { *x = BatchCreateResponse{} - mi := &file_rpc_category_proto_msgTypes[15] + mi := &file_rpc_category_proto_msgTypes[16] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -863,7 +908,7 @@ func (x *BatchCreateResponse) String() string { func (*BatchCreateResponse) ProtoMessage() {} func (x *BatchCreateResponse) ProtoReflect() protoreflect.Message { - mi := &file_rpc_category_proto_msgTypes[15] + mi := &file_rpc_category_proto_msgTypes[16] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -876,7 +921,7 @@ func (x *BatchCreateResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use BatchCreateResponse.ProtoReflect.Descriptor instead. func (*BatchCreateResponse) Descriptor() ([]byte, []int) { - return file_rpc_category_proto_rawDescGZIP(), []int{15} + return file_rpc_category_proto_rawDescGZIP(), []int{16} } func (x *BatchCreateResponse) GetCreatedCategories() []*CategoryInfo { @@ -909,7 +954,7 @@ type BatchUpdateRequest struct { func (x *BatchUpdateRequest) Reset() { *x = BatchUpdateRequest{} - mi := &file_rpc_category_proto_msgTypes[16] + mi := &file_rpc_category_proto_msgTypes[17] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -921,7 +966,7 @@ func (x *BatchUpdateRequest) String() string { func (*BatchUpdateRequest) ProtoMessage() {} func (x *BatchUpdateRequest) ProtoReflect() protoreflect.Message { - mi := &file_rpc_category_proto_msgTypes[16] + mi := &file_rpc_category_proto_msgTypes[17] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -934,7 +979,7 @@ func (x *BatchUpdateRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use BatchUpdateRequest.ProtoReflect.Descriptor instead. func (*BatchUpdateRequest) Descriptor() ([]byte, []int) { - return file_rpc_category_proto_rawDescGZIP(), []int{16} + return file_rpc_category_proto_rawDescGZIP(), []int{17} } func (x *BatchUpdateRequest) GetCategories() []*UpdateCategoryRequest { @@ -955,7 +1000,7 @@ type BatchUpdateResponse struct { func (x *BatchUpdateResponse) Reset() { *x = BatchUpdateResponse{} - mi := &file_rpc_category_proto_msgTypes[17] + mi := &file_rpc_category_proto_msgTypes[18] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -967,7 +1012,7 @@ func (x *BatchUpdateResponse) String() string { func (*BatchUpdateResponse) ProtoMessage() {} func (x *BatchUpdateResponse) ProtoReflect() protoreflect.Message { - mi := &file_rpc_category_proto_msgTypes[17] + mi := &file_rpc_category_proto_msgTypes[18] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -980,7 +1025,7 @@ func (x *BatchUpdateResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use BatchUpdateResponse.ProtoReflect.Descriptor instead. func (*BatchUpdateResponse) Descriptor() ([]byte, []int) { - return file_rpc_category_proto_rawDescGZIP(), []int{17} + return file_rpc_category_proto_rawDescGZIP(), []int{18} } func (x *BatchUpdateResponse) GetUpdatedCategories() []*CategoryInfo { @@ -1019,7 +1064,7 @@ type ListCategoryRequest struct { func (x *ListCategoryRequest) Reset() { *x = ListCategoryRequest{} - mi := &file_rpc_category_proto_msgTypes[18] + mi := &file_rpc_category_proto_msgTypes[19] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1031,7 +1076,7 @@ func (x *ListCategoryRequest) String() string { func (*ListCategoryRequest) ProtoMessage() {} func (x *ListCategoryRequest) ProtoReflect() protoreflect.Message { - mi := &file_rpc_category_proto_msgTypes[18] + mi := &file_rpc_category_proto_msgTypes[19] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1044,7 +1089,7 @@ func (x *ListCategoryRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use ListCategoryRequest.ProtoReflect.Descriptor instead. func (*ListCategoryRequest) Descriptor() ([]byte, []int) { - return file_rpc_category_proto_rawDescGZIP(), []int{18} + return file_rpc_category_proto_rawDescGZIP(), []int{19} } func (x *ListCategoryRequest) GetSystemId() string { @@ -1100,7 +1145,7 @@ type CategoryListResponse struct { func (x *CategoryListResponse) Reset() { *x = CategoryListResponse{} - mi := &file_rpc_category_proto_msgTypes[19] + mi := &file_rpc_category_proto_msgTypes[20] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1112,7 +1157,7 @@ func (x *CategoryListResponse) String() string { func (*CategoryListResponse) ProtoMessage() {} func (x *CategoryListResponse) ProtoReflect() protoreflect.Message { - mi := &file_rpc_category_proto_msgTypes[19] + mi := &file_rpc_category_proto_msgTypes[20] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1125,7 +1170,7 @@ func (x *CategoryListResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use CategoryListResponse.ProtoReflect.Descriptor instead. func (*CategoryListResponse) Descriptor() ([]byte, []int) { - return file_rpc_category_proto_rawDescGZIP(), []int{19} + return file_rpc_category_proto_rawDescGZIP(), []int{20} } func (x *CategoryListResponse) GetCategories() []*CategoryInfo { @@ -1152,7 +1197,7 @@ type CategoryTreeResponse struct { func (x *CategoryTreeResponse) Reset() { *x = CategoryTreeResponse{} - mi := &file_rpc_category_proto_msgTypes[20] + mi := &file_rpc_category_proto_msgTypes[21] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1164,7 +1209,7 @@ func (x *CategoryTreeResponse) String() string { func (*CategoryTreeResponse) ProtoMessage() {} func (x *CategoryTreeResponse) ProtoReflect() protoreflect.Message { - mi := &file_rpc_category_proto_msgTypes[20] + mi := &file_rpc_category_proto_msgTypes[21] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1177,7 +1222,7 @@ func (x *CategoryTreeResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use CategoryTreeResponse.ProtoReflect.Descriptor instead. func (*CategoryTreeResponse) Descriptor() ([]byte, []int) { - return file_rpc_category_proto_rawDescGZIP(), []int{20} + return file_rpc_category_proto_rawDescGZIP(), []int{21} } func (x *CategoryTreeResponse) GetRoot() *CategoryTreeResponse_TreeNode { @@ -1199,7 +1244,7 @@ type CheckAliasRequest struct { func (x *CheckAliasRequest) Reset() { *x = CheckAliasRequest{} - mi := &file_rpc_category_proto_msgTypes[21] + mi := &file_rpc_category_proto_msgTypes[22] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1211,7 +1256,7 @@ func (x *CheckAliasRequest) String() string { func (*CheckAliasRequest) ProtoMessage() {} func (x *CheckAliasRequest) ProtoReflect() protoreflect.Message { - mi := &file_rpc_category_proto_msgTypes[21] + mi := &file_rpc_category_proto_msgTypes[22] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1224,7 +1269,7 @@ func (x *CheckAliasRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use CheckAliasRequest.ProtoReflect.Descriptor instead. func (*CheckAliasRequest) Descriptor() ([]byte, []int) { - return file_rpc_category_proto_rawDescGZIP(), []int{21} + return file_rpc_category_proto_rawDescGZIP(), []int{22} } func (x *CheckAliasRequest) GetSystemId() string { @@ -1259,7 +1304,7 @@ type CheckAliasResponse struct { func (x *CheckAliasResponse) Reset() { *x = CheckAliasResponse{} - mi := &file_rpc_category_proto_msgTypes[22] + mi := &file_rpc_category_proto_msgTypes[23] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1271,7 +1316,7 @@ func (x *CheckAliasResponse) String() string { func (*CheckAliasResponse) ProtoMessage() {} func (x *CheckAliasResponse) ProtoReflect() protoreflect.Message { - mi := &file_rpc_category_proto_msgTypes[22] + mi := &file_rpc_category_proto_msgTypes[23] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1284,7 +1329,7 @@ func (x *CheckAliasResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use CheckAliasResponse.ProtoReflect.Descriptor instead. func (*CheckAliasResponse) Descriptor() ([]byte, []int) { - return file_rpc_category_proto_rawDescGZIP(), []int{22} + return file_rpc_category_proto_rawDescGZIP(), []int{23} } func (x *CheckAliasResponse) GetIsAvailable() bool { @@ -1314,7 +1359,7 @@ type GetSystemCategoriesRequest struct { func (x *GetSystemCategoriesRequest) Reset() { *x = GetSystemCategoriesRequest{} - mi := &file_rpc_category_proto_msgTypes[23] + mi := &file_rpc_category_proto_msgTypes[24] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1326,7 +1371,7 @@ func (x *GetSystemCategoriesRequest) String() string { func (*GetSystemCategoriesRequest) ProtoMessage() {} func (x *GetSystemCategoriesRequest) ProtoReflect() protoreflect.Message { - mi := &file_rpc_category_proto_msgTypes[23] + mi := &file_rpc_category_proto_msgTypes[24] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1339,7 +1384,7 @@ func (x *GetSystemCategoriesRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use GetSystemCategoriesRequest.ProtoReflect.Descriptor instead. func (*GetSystemCategoriesRequest) Descriptor() ([]byte, []int) { - return file_rpc_category_proto_rawDescGZIP(), []int{23} + return file_rpc_category_proto_rawDescGZIP(), []int{24} } func (x *GetSystemCategoriesRequest) GetSystemId() string { @@ -1389,7 +1434,7 @@ type GetSystemCategoriesResponse struct { func (x *GetSystemCategoriesResponse) Reset() { *x = GetSystemCategoriesResponse{} - mi := &file_rpc_category_proto_msgTypes[24] + mi := &file_rpc_category_proto_msgTypes[25] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1401,7 +1446,7 @@ func (x *GetSystemCategoriesResponse) String() string { func (*GetSystemCategoriesResponse) ProtoMessage() {} func (x *GetSystemCategoriesResponse) ProtoReflect() protoreflect.Message { - mi := &file_rpc_category_proto_msgTypes[24] + mi := &file_rpc_category_proto_msgTypes[25] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1414,7 +1459,7 @@ func (x *GetSystemCategoriesResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use GetSystemCategoriesResponse.ProtoReflect.Descriptor instead. func (*GetSystemCategoriesResponse) Descriptor() ([]byte, []int) { - return file_rpc_category_proto_rawDescGZIP(), []int{24} + return file_rpc_category_proto_rawDescGZIP(), []int{25} } func (x *GetSystemCategoriesResponse) GetCategories() []*CategoryInfo { @@ -1455,7 +1500,7 @@ type CategoryTreeResponse_TreeNode struct { func (x *CategoryTreeResponse_TreeNode) Reset() { *x = CategoryTreeResponse_TreeNode{} - mi := &file_rpc_category_proto_msgTypes[25] + mi := &file_rpc_category_proto_msgTypes[26] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1467,7 +1512,7 @@ func (x *CategoryTreeResponse_TreeNode) String() string { func (*CategoryTreeResponse_TreeNode) ProtoMessage() {} func (x *CategoryTreeResponse_TreeNode) ProtoReflect() protoreflect.Message { - mi := &file_rpc_category_proto_msgTypes[25] + mi := &file_rpc_category_proto_msgTypes[26] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1480,7 +1525,7 @@ func (x *CategoryTreeResponse_TreeNode) ProtoReflect() protoreflect.Message { // Deprecated: Use CategoryTreeResponse_TreeNode.ProtoReflect.Descriptor instead. func (*CategoryTreeResponse_TreeNode) Descriptor() ([]byte, []int) { - return file_rpc_category_proto_rawDescGZIP(), []int{20, 0} + return file_rpc_category_proto_rawDescGZIP(), []int{21, 0} } func (x *CategoryTreeResponse_TreeNode) GetCategory() *CategoryInfo { @@ -1534,7 +1579,9 @@ const file_rpc_category_proto_rawDesc = "" + "\x0eDeleteResponse\x12\x18\n" + "\asuccess\x18\x01 \x01(\bR\asuccess\"$\n" + "\x12GetCategoryRequest\x12\x0e\n" + - "\x02id\x18\x01 \x01(\tR\x02id\"J\n" + + "\x02id\x18\x01 \x01(\tR\x02id\"I\n" + + "\x19GetFullCategoriesResponse\x12,\n" + + "\x12full_category_name\x18\x01 \x01(\tR\x10fullCategoryName\"J\n" + "\x14CategoryInfoResponse\x122\n" + "\bcategory\x18\x01 \x01(\v2\x16.category.CategoryInfoR\bcategory\"O\n" + "\x12GetChildrenRequest\x12\x1b\n" + @@ -1605,7 +1652,7 @@ const file_rpc_category_proto_rawDesc = "" + "categories\x12\x14\n" + "\x05total\x18\x02 \x01(\x03R\x05total\x12!\n" + "\fcurrent_page\x18\x03 \x01(\x05R\vcurrentPage\x12\x1b\n" + - "\tpage_size\x18\x04 \x01(\x05R\bpageSize2\xe1\b\n" + + "\tpage_size\x18\x04 \x01(\x05R\bpageSize2\xb9\t\n" + "\bCategory\x125\n" + "\x04Ping\x12\x15.category.PingRequest\x1a\x16.category.PingResponse\x12Q\n" + "\x0eCreateCategory\x12\x1f.category.CreateCategoryRequest\x1a\x1e.category.CategoryInfoResponse\x12Q\n" + @@ -1621,7 +1668,8 @@ const file_rpc_category_proto_rawDesc = "" + "\x0eListCategories\x12\x1d.category.ListCategoryRequest\x1a\x1e.category.CategoryListResponse\x12G\n" + "\n" + "CheckAlias\x12\x1b.category.CheckAliasRequest\x1a\x1c.category.CheckAliasResponse\x12b\n" + - "\x13GetSystemCategories\x12$.category.GetSystemCategoriesRequest\x1a%.category.GetSystemCategoriesResponseB\fZ\n" + + "\x13GetSystemCategories\x12$.category.GetSystemCategoriesRequest\x1a%.category.GetSystemCategoriesResponse\x12V\n" + + "\x11GetFullCategories\x12\x1c.category.GetCategoryRequest\x1a#.category.GetFullCategoriesResponseB\fZ\n" + "./categoryb\x06proto3" var ( @@ -1636,7 +1684,7 @@ func file_rpc_category_proto_rawDescGZIP() []byte { return file_rpc_category_proto_rawDescData } -var file_rpc_category_proto_msgTypes = make([]protoimpl.MessageInfo, 26) +var file_rpc_category_proto_msgTypes = make([]protoimpl.MessageInfo, 27) var file_rpc_category_proto_goTypes = []any{ (*PingRequest)(nil), // 0: category.PingRequest (*PingResponse)(nil), // 1: category.PingResponse @@ -1646,24 +1694,25 @@ var file_rpc_category_proto_goTypes = []any{ (*DeleteCategoryRequest)(nil), // 5: category.DeleteCategoryRequest (*DeleteResponse)(nil), // 6: category.DeleteResponse (*GetCategoryRequest)(nil), // 7: category.GetCategoryRequest - (*CategoryInfoResponse)(nil), // 8: category.CategoryInfoResponse - (*GetChildrenRequest)(nil), // 9: category.GetChildrenRequest - (*GetTreeRequest)(nil), // 10: category.GetTreeRequest - (*MoveCategoryRequest)(nil), // 11: category.MoveCategoryRequest - (*GetAncestorPathRequest)(nil), // 12: category.GetAncestorPathRequest - (*CategoryPathResponse)(nil), // 13: category.CategoryPathResponse - (*BatchCreateRequest)(nil), // 14: category.BatchCreateRequest - (*BatchCreateResponse)(nil), // 15: category.BatchCreateResponse - (*BatchUpdateRequest)(nil), // 16: category.BatchUpdateRequest - (*BatchUpdateResponse)(nil), // 17: category.BatchUpdateResponse - (*ListCategoryRequest)(nil), // 18: category.ListCategoryRequest - (*CategoryListResponse)(nil), // 19: category.CategoryListResponse - (*CategoryTreeResponse)(nil), // 20: category.CategoryTreeResponse - (*CheckAliasRequest)(nil), // 21: category.CheckAliasRequest - (*CheckAliasResponse)(nil), // 22: category.CheckAliasResponse - (*GetSystemCategoriesRequest)(nil), // 23: category.GetSystemCategoriesRequest - (*GetSystemCategoriesResponse)(nil), // 24: category.GetSystemCategoriesResponse - (*CategoryTreeResponse_TreeNode)(nil), // 25: category.CategoryTreeResponse.TreeNode + (*GetFullCategoriesResponse)(nil), // 8: category.GetFullCategoriesResponse + (*CategoryInfoResponse)(nil), // 9: category.CategoryInfoResponse + (*GetChildrenRequest)(nil), // 10: category.GetChildrenRequest + (*GetTreeRequest)(nil), // 11: category.GetTreeRequest + (*MoveCategoryRequest)(nil), // 12: category.MoveCategoryRequest + (*GetAncestorPathRequest)(nil), // 13: category.GetAncestorPathRequest + (*CategoryPathResponse)(nil), // 14: category.CategoryPathResponse + (*BatchCreateRequest)(nil), // 15: category.BatchCreateRequest + (*BatchCreateResponse)(nil), // 16: category.BatchCreateResponse + (*BatchUpdateRequest)(nil), // 17: category.BatchUpdateRequest + (*BatchUpdateResponse)(nil), // 18: category.BatchUpdateResponse + (*ListCategoryRequest)(nil), // 19: category.ListCategoryRequest + (*CategoryListResponse)(nil), // 20: category.CategoryListResponse + (*CategoryTreeResponse)(nil), // 21: category.CategoryTreeResponse + (*CheckAliasRequest)(nil), // 22: category.CheckAliasRequest + (*CheckAliasResponse)(nil), // 23: category.CheckAliasResponse + (*GetSystemCategoriesRequest)(nil), // 24: category.GetSystemCategoriesRequest + (*GetSystemCategoriesResponse)(nil), // 25: category.GetSystemCategoriesResponse + (*CategoryTreeResponse_TreeNode)(nil), // 26: category.CategoryTreeResponse.TreeNode } var file_rpc_category_proto_depIdxs = []int32{ 2, // 0: category.CategoryInfoResponse.category:type_name -> category.CategoryInfo @@ -1673,40 +1722,42 @@ var file_rpc_category_proto_depIdxs = []int32{ 4, // 4: category.BatchUpdateRequest.categories:type_name -> category.UpdateCategoryRequest 2, // 5: category.BatchUpdateResponse.updated_categories:type_name -> category.CategoryInfo 2, // 6: category.CategoryListResponse.categories:type_name -> category.CategoryInfo - 25, // 7: category.CategoryTreeResponse.root:type_name -> category.CategoryTreeResponse.TreeNode + 26, // 7: category.CategoryTreeResponse.root:type_name -> category.CategoryTreeResponse.TreeNode 2, // 8: category.GetSystemCategoriesResponse.categories:type_name -> category.CategoryInfo 2, // 9: category.CategoryTreeResponse.TreeNode.category:type_name -> category.CategoryInfo - 25, // 10: category.CategoryTreeResponse.TreeNode.children:type_name -> category.CategoryTreeResponse.TreeNode + 26, // 10: category.CategoryTreeResponse.TreeNode.children:type_name -> category.CategoryTreeResponse.TreeNode 0, // 11: category.Category.Ping:input_type -> category.PingRequest 3, // 12: category.Category.CreateCategory:input_type -> category.CreateCategoryRequest 4, // 13: category.Category.UpdateCategory:input_type -> category.UpdateCategoryRequest 5, // 14: category.Category.DeleteCategory:input_type -> category.DeleteCategoryRequest 7, // 15: category.Category.GetCategory:input_type -> category.GetCategoryRequest - 9, // 16: category.Category.GetChildren:input_type -> category.GetChildrenRequest - 10, // 17: category.Category.GetTree:input_type -> category.GetTreeRequest - 11, // 18: category.Category.MoveCategory:input_type -> category.MoveCategoryRequest - 12, // 19: category.Category.GetAncestorPath:input_type -> category.GetAncestorPathRequest - 14, // 20: category.Category.BatchCreateCategories:input_type -> category.BatchCreateRequest - 16, // 21: category.Category.BatchUpdateCategories:input_type -> category.BatchUpdateRequest - 18, // 22: category.Category.ListCategories:input_type -> category.ListCategoryRequest - 21, // 23: category.Category.CheckAlias:input_type -> category.CheckAliasRequest - 23, // 24: category.Category.GetSystemCategories:input_type -> category.GetSystemCategoriesRequest - 1, // 25: category.Category.Ping:output_type -> category.PingResponse - 8, // 26: category.Category.CreateCategory:output_type -> category.CategoryInfoResponse - 8, // 27: category.Category.UpdateCategory:output_type -> category.CategoryInfoResponse - 6, // 28: category.Category.DeleteCategory:output_type -> category.DeleteResponse - 8, // 29: category.Category.GetCategory:output_type -> category.CategoryInfoResponse - 19, // 30: category.Category.GetChildren:output_type -> category.CategoryListResponse - 20, // 31: category.Category.GetTree:output_type -> category.CategoryTreeResponse - 8, // 32: category.Category.MoveCategory:output_type -> category.CategoryInfoResponse - 13, // 33: category.Category.GetAncestorPath:output_type -> category.CategoryPathResponse - 15, // 34: category.Category.BatchCreateCategories:output_type -> category.BatchCreateResponse - 17, // 35: category.Category.BatchUpdateCategories:output_type -> category.BatchUpdateResponse - 19, // 36: category.Category.ListCategories:output_type -> category.CategoryListResponse - 22, // 37: category.Category.CheckAlias:output_type -> category.CheckAliasResponse - 24, // 38: category.Category.GetSystemCategories:output_type -> category.GetSystemCategoriesResponse - 25, // [25:39] is the sub-list for method output_type - 11, // [11:25] is the sub-list for method input_type + 10, // 16: category.Category.GetChildren:input_type -> category.GetChildrenRequest + 11, // 17: category.Category.GetTree:input_type -> category.GetTreeRequest + 12, // 18: category.Category.MoveCategory:input_type -> category.MoveCategoryRequest + 13, // 19: category.Category.GetAncestorPath:input_type -> category.GetAncestorPathRequest + 15, // 20: category.Category.BatchCreateCategories:input_type -> category.BatchCreateRequest + 17, // 21: category.Category.BatchUpdateCategories:input_type -> category.BatchUpdateRequest + 19, // 22: category.Category.ListCategories:input_type -> category.ListCategoryRequest + 22, // 23: category.Category.CheckAlias:input_type -> category.CheckAliasRequest + 24, // 24: category.Category.GetSystemCategories:input_type -> category.GetSystemCategoriesRequest + 7, // 25: category.Category.GetFullCategories:input_type -> category.GetCategoryRequest + 1, // 26: category.Category.Ping:output_type -> category.PingResponse + 9, // 27: category.Category.CreateCategory:output_type -> category.CategoryInfoResponse + 9, // 28: category.Category.UpdateCategory:output_type -> category.CategoryInfoResponse + 6, // 29: category.Category.DeleteCategory:output_type -> category.DeleteResponse + 9, // 30: category.Category.GetCategory:output_type -> category.CategoryInfoResponse + 20, // 31: category.Category.GetChildren:output_type -> category.CategoryListResponse + 21, // 32: category.Category.GetTree:output_type -> category.CategoryTreeResponse + 9, // 33: category.Category.MoveCategory:output_type -> category.CategoryInfoResponse + 14, // 34: category.Category.GetAncestorPath:output_type -> category.CategoryPathResponse + 16, // 35: category.Category.BatchCreateCategories:output_type -> category.BatchCreateResponse + 18, // 36: category.Category.BatchUpdateCategories:output_type -> category.BatchUpdateResponse + 20, // 37: category.Category.ListCategories:output_type -> category.CategoryListResponse + 23, // 38: category.Category.CheckAlias:output_type -> category.CheckAliasResponse + 25, // 39: category.Category.GetSystemCategories:output_type -> category.GetSystemCategoriesResponse + 8, // 40: category.Category.GetFullCategories:output_type -> category.GetFullCategoriesResponse + 26, // [26:41] is the sub-list for method output_type + 11, // [11:26] is the sub-list for method input_type 11, // [11:11] is the sub-list for extension type_name 11, // [11:11] is the sub-list for extension extendee 0, // [0:11] is the sub-list for field type_name @@ -1723,7 +1774,7 @@ func file_rpc_category_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: unsafe.Slice(unsafe.StringData(file_rpc_category_proto_rawDesc), len(file_rpc_category_proto_rawDesc)), NumEnums: 0, - NumMessages: 26, + NumMessages: 27, NumExtensions: 0, NumServices: 1, }, diff --git a/category/category/category_grpc.pb.go b/category/category/category_grpc.pb.go index 53e3303..c692fd5 100644 --- a/category/category/category_grpc.pb.go +++ b/category/category/category_grpc.pb.go @@ -33,6 +33,7 @@ const ( Category_ListCategories_FullMethodName = "/category.Category/ListCategories" Category_CheckAlias_FullMethodName = "/category.Category/CheckAlias" Category_GetSystemCategories_FullMethodName = "/category.Category/GetSystemCategories" + Category_GetFullCategories_FullMethodName = "/category.Category/GetFullCategories" ) // CategoryClient is the client API for Category service. @@ -61,6 +62,8 @@ type CategoryClient interface { CheckAlias(ctx context.Context, in *CheckAliasRequest, opts ...grpc.CallOption) (*CheckAliasResponse, error) // 根据系统ID获取分类 GetSystemCategories(ctx context.Context, in *GetSystemCategoriesRequest, opts ...grpc.CallOption) (*GetSystemCategoriesResponse, error) + // 获取某一个类别的完整类别(从根类别到当前类别的所有类别) + GetFullCategories(ctx context.Context, in *GetCategoryRequest, opts ...grpc.CallOption) (*GetFullCategoriesResponse, error) } type categoryClient struct { @@ -211,6 +214,16 @@ func (c *categoryClient) GetSystemCategories(ctx context.Context, in *GetSystemC return out, nil } +func (c *categoryClient) GetFullCategories(ctx context.Context, in *GetCategoryRequest, opts ...grpc.CallOption) (*GetFullCategoriesResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(GetFullCategoriesResponse) + err := c.cc.Invoke(ctx, Category_GetFullCategories_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + // CategoryServer is the server API for Category service. // All implementations must embed UnimplementedCategoryServer // for forward compatibility. @@ -237,6 +250,8 @@ type CategoryServer interface { CheckAlias(context.Context, *CheckAliasRequest) (*CheckAliasResponse, error) // 根据系统ID获取分类 GetSystemCategories(context.Context, *GetSystemCategoriesRequest) (*GetSystemCategoriesResponse, error) + // 获取某一个类别的完整类别(从根类别到当前类别的所有类别) + GetFullCategories(context.Context, *GetCategoryRequest) (*GetFullCategoriesResponse, error) mustEmbedUnimplementedCategoryServer() } @@ -289,6 +304,9 @@ func (UnimplementedCategoryServer) CheckAlias(context.Context, *CheckAliasReques func (UnimplementedCategoryServer) GetSystemCategories(context.Context, *GetSystemCategoriesRequest) (*GetSystemCategoriesResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method GetSystemCategories not implemented") } +func (UnimplementedCategoryServer) GetFullCategories(context.Context, *GetCategoryRequest) (*GetFullCategoriesResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetFullCategories not implemented") +} func (UnimplementedCategoryServer) mustEmbedUnimplementedCategoryServer() {} func (UnimplementedCategoryServer) testEmbeddedByValue() {} @@ -562,6 +580,24 @@ func _Category_GetSystemCategories_Handler(srv interface{}, ctx context.Context, return interceptor(ctx, in, info, handler) } +func _Category_GetFullCategories_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetCategoryRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(CategoryServer).GetFullCategories(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Category_GetFullCategories_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(CategoryServer).GetFullCategories(ctx, req.(*GetCategoryRequest)) + } + return interceptor(ctx, in, info, handler) +} + // Category_ServiceDesc is the grpc.ServiceDesc for Category service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) @@ -625,6 +661,10 @@ var Category_ServiceDesc = grpc.ServiceDesc{ MethodName: "GetSystemCategories", Handler: _Category_GetSystemCategories_Handler, }, + { + MethodName: "GetFullCategories", + Handler: _Category_GetFullCategories_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "rpc/category.proto", diff --git a/category/categoryclient/category.go b/category/categoryclient/category.go index d7aef74..bc2a1b1 100644 --- a/category/categoryclient/category.go +++ b/category/categoryclient/category.go @@ -32,6 +32,7 @@ type ( GetAncestorPathRequest = category.GetAncestorPathRequest GetCategoryRequest = category.GetCategoryRequest GetChildrenRequest = category.GetChildrenRequest + GetFullCategoriesResponse = category.GetFullCategoriesResponse GetSystemCategoriesRequest = category.GetSystemCategoriesRequest GetSystemCategoriesResponse = category.GetSystemCategoriesResponse GetTreeRequest = category.GetTreeRequest @@ -62,6 +63,8 @@ type ( CheckAlias(ctx context.Context, in *CheckAliasRequest, opts ...grpc.CallOption) (*CheckAliasResponse, error) // 根据系统ID获取分类 GetSystemCategories(ctx context.Context, in *GetSystemCategoriesRequest, opts ...grpc.CallOption) (*GetSystemCategoriesResponse, error) + // 获取某一个类别的完整类别(从根类别到当前类别的所有类别) + GetFullCategories(ctx context.Context, in *GetCategoryRequest, opts ...grpc.CallOption) (*GetFullCategoriesResponse, error) } defaultCategory struct { @@ -150,3 +153,9 @@ func (m *defaultCategory) GetSystemCategories(ctx context.Context, in *GetSystem client := category.NewCategoryClient(m.cli.Conn()) return client.GetSystemCategories(ctx, in, opts...) } + +// 获取某一个类别的完整类别(从根类别到当前类别的所有类别) +func (m *defaultCategory) GetFullCategories(ctx context.Context, in *GetCategoryRequest, opts ...grpc.CallOption) (*GetFullCategoriesResponse, error) { + client := category.NewCategoryClient(m.cli.Conn()) + return client.GetFullCategories(ctx, in, opts...) +} diff --git a/category/internal/logic/getfullcategorieslogic.go b/category/internal/logic/getfullcategorieslogic.go new file mode 100644 index 0000000..ad5e8e0 --- /dev/null +++ b/category/internal/logic/getfullcategorieslogic.go @@ -0,0 +1,73 @@ +package logic + +import ( + "context" + "errors" + + "godemo/category/category" + "godemo/category/internal/model" + "godemo/category/internal/svc" + + "github.com/zeromicro/go-zero/core/logx" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +type GetFullCategoriesLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger +} + +func NewGetFullCategoriesLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetFullCategoriesLogic { + return &GetFullCategoriesLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +// 获取某一个类别的完整类别(从根类别到当前类别的所有类别) +func (l *GetFullCategoriesLogic) GetFullCategories(in *category.GetCategoryRequest) (*category.GetFullCategoriesResponse, error) { + // 1. 参数校验 + if in.Id == "" { + return nil, status.Error(codes.InvalidArgument, "分类ID不能为空") + } + + // 2. 查询当前分类 + current, err := l.svcCtx.CategoryModel.FindOne(l.ctx, in.Id) + if err != nil { + if errors.Is(err, model.ErrNotFound) { + l.Logger.Errorf("分类不存在, ID: %s", in.Id) + return nil, status.Error(codes.NotFound, "分类不存在") + } + l.Logger.Errorf("数据库查询失败: %v", err) + return nil, status.Error(codes.Internal, "内部错误") + } + + // 3. 初始化路径为当前分类名称 + fullPath := current.Name + + // 4. 循环获取父分类 + parentID := current.ParentId + for parentID.Valid { + // 查询父分类 + parent, err := l.svcCtx.CategoryModel.FindOne(l.ctx, parentID.String) + if err != nil { + if errors.Is(err, model.ErrNotFound) { + l.Logger.Errorf("父分类不存在, ID: %s", parentID.String) + break // 遇到不存在的父分类时停止循环 + } + l.Logger.Errorf("查询父分类失败: %v", err) + break // 其他错误也停止循环 + } + + // 将父分类名称添加到路径前面 + fullPath = parent.Name + "/" + fullPath + parentID = parent.ParentId // 准备查询上一级父分类 + } + + return &category.GetFullCategoriesResponse{ + FullCategoryName: fullPath, + }, nil +} diff --git a/category/internal/server/categoryserver.go b/category/internal/server/categoryserver.go index 8600280..97426c6 100644 --- a/category/internal/server/categoryserver.go +++ b/category/internal/server/categoryserver.go @@ -98,3 +98,9 @@ func (s *CategoryServer) GetSystemCategories(ctx context.Context, in *category.G l := logic.NewGetSystemCategoriesLogic(ctx, s.svcCtx) return l.GetSystemCategories(in) } + +// 获取某一个类别的完整类别(从根类别到当前类别的所有类别) +func (s *CategoryServer) GetFullCategories(ctx context.Context, in *category.GetCategoryRequest) (*category.GetFullCategoriesResponse, error) { + l := logic.NewGetFullCategoriesLogic(ctx, s.svcCtx) + return l.GetFullCategories(in) +} diff --git a/file/file/file.pb.go b/file/file/file.pb.go index 64954b9..26ccb0c 100644 --- a/file/file/file.pb.go +++ b/file/file/file.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.36.6 -// protoc v3.20.3 +// protoc v3.19.4 // source: rpc/file.proto package file @@ -27,7 +27,8 @@ type UploadRequest struct { Filename string `protobuf:"bytes,1,opt,name=filename,proto3" json:"filename,omitempty"` // 文件名(建议客户端传原始名,服务端会生成唯一名) ContentType string `protobuf:"bytes,2,opt,name=content_type,json=contentType,proto3" json:"content_type,omitempty"` // 文件类型(如 image/jpeg) Content []byte `protobuf:"bytes,3,opt,name=content,proto3" json:"content,omitempty"` // 文件二进制内容(base64 编码由客户端完成) - Folder string `protobuf:"bytes,4,opt,name=folder,proto3" json:"folder,omitempty"` // 可选,文件夹或分类路径,如 "avatars"、"wallpapers" + Folder string `protobuf:"bytes,4,opt,name=folder,proto3" json:"folder,omitempty"` // 可选,文件夹或分类路径,支持多级,如 "avatars"、"wallpapers/animals" + Bucket string `protobuf:"bytes,5,opt,name=bucket,proto3" json:"bucket,omitempty"` // bucket name unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } @@ -90,6 +91,13 @@ func (x *UploadRequest) GetFolder() string { return "" } +func (x *UploadRequest) GetBucket() string { + if x != nil { + return x.Bucket + } + return "" +} + // 上传响应 type UploadResponse struct { state protoimpl.MessageState `protogen:"open.v1"` @@ -327,12 +335,13 @@ var File_rpc_file_proto protoreflect.FileDescriptor const file_rpc_file_proto_rawDesc = "" + "\n" + - "\x0erpc/file.proto\x12\x04file\"\x80\x01\n" + + "\x0erpc/file.proto\x12\x04file\"\x98\x01\n" + "\rUploadRequest\x12\x1a\n" + "\bfilename\x18\x01 \x01(\tR\bfilename\x12!\n" + "\fcontent_type\x18\x02 \x01(\tR\vcontentType\x12\x18\n" + "\acontent\x18\x03 \x01(\fR\acontent\x12\x16\n" + - "\x06folder\x18\x04 \x01(\tR\x06folder\";\n" + + "\x06folder\x18\x04 \x01(\tR\x06folder\x12\x16\n" + + "\x06bucket\x18\x05 \x01(\tR\x06bucket\";\n" + "\x0eUploadResponse\x12\x17\n" + "\afile_id\x18\x01 \x01(\tR\x06fileId\x12\x10\n" + "\x03url\x18\x02 \x01(\tR\x03url\",\n" + diff --git a/file/file/file_grpc.pb.go b/file/file/file_grpc.pb.go index cb39488..d6ac950 100644 --- a/file/file/file_grpc.pb.go +++ b/file/file/file_grpc.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.5.1 -// - protoc v3.20.3 +// - protoc v3.19.4 // source: rpc/file.proto package file diff --git a/file/internal/logic/uploadlogic.go b/file/internal/logic/uploadlogic.go index 7d78f93..93efa30 100644 --- a/file/internal/logic/uploadlogic.go +++ b/file/internal/logic/uploadlogic.go @@ -34,8 +34,8 @@ func NewUploadLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UploadLogi // 上传文件(图片/头像/壁纸等) func (l *UploadLogic) Upload(in *file.UploadRequest) (*file.UploadResponse, error) { bucketName := "default" - if in.Folder != "" { - bucketName = in.Folder + if in.Bucket != "" { + bucketName = in.Bucket } // 确保 bucket 存在(自动创建) @@ -54,6 +54,10 @@ func (l *UploadLogic) Upload(in *file.UploadRequest) (*file.UploadResponse, erro ext := getFileExtension(in.Filename) newFileName := uuid.New().String() + ext + if in.Folder != "" { + newFileName = in.Folder + "/" + newFileName + } + // 上传对象 _, err = l.svcCtx.MinioClient.PutObject(l.ctx, bucketName, newFileName, bytes.NewReader(in.Content), diff --git a/gallery/etc/gallery.yaml b/gallery/etc/gallery.yaml index 20101fd..c14995f 100644 --- a/gallery/etc/gallery.yaml +++ b/gallery/etc/gallery.yaml @@ -1,5 +1,12 @@ Name: gallery.rpc ListenOn: 0.0.0.0:50000 + +DB: + DataSource: postgres://postgres:postgres@localhost:19732/godemo?sslmode=disable + MaxOpenConns: 100 + MaxIdleConns: 20 + ConnMaxLifetime: 3600 + Etcd: Hosts: - 127.0.0.1:2379 @@ -9,4 +16,10 @@ FileRpc: Etcd: Hosts: - 127.0.0.1:2379 - Key: file.rpc \ No newline at end of file + Key: file.rpc + +CategoryRpc: + Etcd: + Hosts: + - 127.0.0.1:2379 + Key: category.rpc \ No newline at end of file diff --git a/gallery/internal/config/config.go b/gallery/internal/config/config.go index 41cf205..b190516 100644 --- a/gallery/internal/config/config.go +++ b/gallery/internal/config/config.go @@ -4,5 +4,12 @@ import "github.com/zeromicro/go-zero/zrpc" type Config struct { zrpc.RpcServerConf - FileRpc zrpc.RpcClientConf + FileRpc zrpc.RpcClientConf + CategoryRpc zrpc.RpcClientConf + DB struct { + DataSource string + MaxOpenConns int + MaxIdleConns int + ConnMaxLifetime int + } } diff --git a/gallery/internal/logic/uploadimagelogic.go b/gallery/internal/logic/uploadimagelogic.go index fb6f629..85bf6a5 100644 --- a/gallery/internal/logic/uploadimagelogic.go +++ b/gallery/internal/logic/uploadimagelogic.go @@ -3,11 +3,14 @@ package logic import ( "context" + "godemo/category/category" "godemo/file/file" "godemo/gallery/gallery" "godemo/gallery/internal/svc" "github.com/zeromicro/go-zero/core/logx" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" ) type UploadImageLogic struct { @@ -27,13 +30,18 @@ func NewUploadImageLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Uploa // 图片上传 func (l *UploadImageLogic) UploadImage(in *gallery.UploadImageRequest) (*gallery.UploadImageResponse, error) { // 1. 根据 in.CategoryId 查询分类信息,获取分类名称 - var categoryName string + getCategoryRpcResp, getCategoryRpcErr := l.svcCtx.CategoryRpc.GetCategory(l.ctx, &category.GetCategoryRequest{ + Id: *in.CategoryId, + }) + if getCategoryRpcErr != nil { + return nil, status.Error(codes.Internal, getCategoryRpcErr.Error()) + } // 2. 调用 file rpc Upload 接口,上传文件到MinIO - l.svcCtx.FileRpc.Upload(l.ctx, &file.UploadRequest{ + fileUploadRpcResp, fileUploadRpcErr := l.svcCtx.FileRpc.Upload(l.ctx, &file.UploadRequest{ Filename: in.FileName, Content: in.FileContent, - Folder: categoryName, + Folder: getCategoryRpcResp.Category.Name, }) // 3. 图片信息存入数据库 diff --git a/gallery/internal/model/imagesmodel.go b/gallery/internal/model/imagesmodel.go new file mode 100644 index 0000000..adeb9ca --- /dev/null +++ b/gallery/internal/model/imagesmodel.go @@ -0,0 +1,29 @@ +package model + +import "github.com/zeromicro/go-zero/core/stores/sqlx" + +var _ ImagesModel = (*customImagesModel)(nil) + +type ( + // ImagesModel is an interface to be customized, add more methods here, + // and implement the added methods in customImagesModel. + ImagesModel interface { + imagesModel + withSession(session sqlx.Session) ImagesModel + } + + customImagesModel struct { + *defaultImagesModel + } +) + +// NewImagesModel returns a model for the database table. +func NewImagesModel(conn sqlx.SqlConn) ImagesModel { + return &customImagesModel{ + defaultImagesModel: newImagesModel(conn), + } +} + +func (m *customImagesModel) withSession(session sqlx.Session) ImagesModel { + return NewImagesModel(sqlx.NewSqlConnFromSession(session)) +} diff --git a/gallery/internal/model/imagesmodel_gen.go b/gallery/internal/model/imagesmodel_gen.go new file mode 100644 index 0000000..40d9637 --- /dev/null +++ b/gallery/internal/model/imagesmodel_gen.go @@ -0,0 +1,97 @@ +// Code generated by goctl. DO NOT EDIT. +// versions: +// goctl version: 1.8.3 + +package model + +import ( + "context" + "database/sql" + "fmt" + "strings" + "time" + + "github.com/lib/pq" + "github.com/zeromicro/go-zero/core/stores/builder" + "github.com/zeromicro/go-zero/core/stores/sqlx" + "github.com/zeromicro/go-zero/core/stringx" +) + +var ( + imagesFieldNames = builder.RawFieldNames(&Images{}, true) + imagesRows = strings.Join(imagesFieldNames, ",") + imagesRowsExpectAutoSet = strings.Join(stringx.Remove(imagesFieldNames, "create_at", "create_time", "created_at", "update_at", "update_time", "updated_at"), ",") + imagesRowsWithPlaceHolder = builder.PostgreSqlJoin(stringx.Remove(imagesFieldNames, "image_id", "create_at", "create_time", "created_at", "update_at", "update_time", "updated_at")) +) + +type ( + imagesModel interface { + Insert(ctx context.Context, data *Images) (sql.Result, error) + FindOne(ctx context.Context, imageId string) (*Images, error) + Update(ctx context.Context, data *Images) error + Delete(ctx context.Context, imageId string) error + } + + defaultImagesModel struct { + conn sqlx.SqlConn + table string + } + + Images struct { + ImageId string `db:"image_id"` + StorageKey string `db:"storage_key"` + FileName string `db:"file_name"` + MimeType string `db:"mime_type"` + FileSize int64 `db:"file_size"` + Width sql.NullInt64 `db:"width"` + Height sql.NullInt64 `db:"height"` + CategoryId sql.NullString `db:"category_id"` + Tags pq.StringArray `db:"tags"` + CreatedAt time.Time `db:"created_at"` + UpdatedAt time.Time `db:"updated_at"` + IsDeleted bool `db:"is_deleted"` + } +) + +func newImagesModel(conn sqlx.SqlConn) *defaultImagesModel { + return &defaultImagesModel{ + conn: conn, + table: `"public"."images"`, + } +} + +func (m *defaultImagesModel) Delete(ctx context.Context, imageId string) error { + query := fmt.Sprintf("delete from %s where image_id = $1", m.table) + _, err := m.conn.ExecCtx(ctx, query, imageId) + return err +} + +func (m *defaultImagesModel) FindOne(ctx context.Context, imageId string) (*Images, error) { + query := fmt.Sprintf("select %s from %s where image_id = $1 limit 1", imagesRows, m.table) + var resp Images + err := m.conn.QueryRowCtx(ctx, &resp, query, imageId) + switch err { + case nil: + return &resp, nil + case sqlx.ErrNotFound: + return nil, ErrNotFound + default: + return nil, err + } +} + +func (m *defaultImagesModel) Insert(ctx context.Context, data *Images) (sql.Result, error) { + query := fmt.Sprintf("insert into %s (%s) values ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10)", m.table, imagesRowsExpectAutoSet) + ret, err := m.conn.ExecCtx(ctx, query, data.ImageId, data.StorageKey, data.FileName, data.MimeType, data.FileSize, data.Width, data.Height, data.CategoryId, data.Tags, data.IsDeleted) + return ret, err +} + +func (m *defaultImagesModel) Update(ctx context.Context, data *Images) error { + query := fmt.Sprintf("update %s set %s where image_id = $1", m.table, imagesRowsWithPlaceHolder) + _, err := m.conn.ExecCtx(ctx, query, data.ImageId, data.StorageKey, data.FileName, data.MimeType, data.FileSize, data.Width, data.Height, data.CategoryId, data.Tags, data.IsDeleted) + return err +} + +func (m *defaultImagesModel) tableName() string { + return m.table +} diff --git a/gallery/internal/model/vars.go b/gallery/internal/model/vars.go new file mode 100644 index 0000000..69ca814 --- /dev/null +++ b/gallery/internal/model/vars.go @@ -0,0 +1,5 @@ +package model + +import "github.com/zeromicro/go-zero/core/stores/sqlx" + +var ErrNotFound = sqlx.ErrNotFound diff --git a/gallery/internal/svc/servicecontext.go b/gallery/internal/svc/servicecontext.go index c649b94..595a55b 100644 --- a/gallery/internal/svc/servicecontext.go +++ b/gallery/internal/svc/servicecontext.go @@ -1,21 +1,28 @@ package svc import ( + "godemo/category/category" "godemo/file/file" "godemo/gallery/internal/config" + "godemo/gallery/internal/model" + _ "github.com/lib/pq" + "github.com/zeromicro/go-zero/core/stores/sqlx" "github.com/zeromicro/go-zero/zrpc" ) type ServiceContext struct { - Config config.Config - FileRpc file.FileClient + Config config.Config + FileRpc file.FileClient + CategoryRpc category.CategoryClient + ImagesModel model.ImagesModel } func NewServiceContext(c config.Config) *ServiceContext { - conn := zrpc.MustNewClient(c.FileRpc).Conn() return &ServiceContext{ - Config: c, - FileRpc: file.NewFileClient(conn), + Config: c, + FileRpc: file.NewFileClient(zrpc.MustNewClient(c.FileRpc).Conn()), + CategoryRpc: category.NewCategoryClient(zrpc.MustNewClient(c.CategoryRpc).Conn()), + ImagesModel: model.NewImagesModel(sqlx.NewSqlConn("postgres", c.DB.DataSource)), } } diff --git a/rpc/category.proto b/rpc/category.proto index d140c87..2e8c03b 100644 --- a/rpc/category.proto +++ b/rpc/category.proto @@ -31,6 +31,9 @@ service Category { // 根据系统ID获取分类 rpc GetSystemCategories(GetSystemCategoriesRequest) returns (GetSystemCategoriesResponse); + + // 获取某一个类别的完整类别(从根类别到当前类别的所有类别) + rpc GetFullCategories(GetCategoryRequest) returns (GetFullCategoriesResponse); } // 健康检查请求 @@ -88,6 +91,11 @@ message GetCategoryRequest { string id = 1; } +// 获取全分类名称的响应 +message GetFullCategoriesResponse { + string full_category_name = 1; +} + // 分类信息响应 message CategoryInfoResponse { CategoryInfo category = 1; diff --git a/rpc/file.proto b/rpc/file.proto index 46c1d9b..a7f7e63 100644 --- a/rpc/file.proto +++ b/rpc/file.proto @@ -21,7 +21,8 @@ message UploadRequest { string filename = 1; // 文件名(建议客户端传原始名,服务端会生成唯一名) string content_type = 2; // 文件类型(如 image/jpeg) bytes content = 3; // 文件二进制内容(base64 编码由客户端完成) - string folder = 4; // 可选,文件夹或分类路径,如 "avatars"、"wallpapers" + string folder = 4; // 可选,文件夹或分类路径,支持多级,如 "avatars"、"wallpapers/animals" + string bucket = 5; // bucket name } // 上传响应 diff --git a/sql/images.sql b/sql/images.sql index 5a85c60..47f834d 100644 --- a/sql/images.sql +++ b/sql/images.sql @@ -1,10 +1,10 @@ -- 图片主表基础版 CREATE TABLE images ( -- 核心标识字段 - image_id UUID PRIMARY KEY DEFAULT gen_random_uuid(), + image_id VARCHAR(36) PRIMARY KEY DEFAULT gen_random_uuid()::varchar, -- 存储元数据 - storage_key TEXT NOT NULL CHECK (storage_key ~ '^[a-z0-9/-]+$'), -- 文件显示名称 + storage_key TEXT NOT NULL, -- 文件显示名称 file_name TEXT NOT NULL, -- 文件存储名称,可以包含路径 mime_type VARCHAR(32) NOT NULL CHECK (mime_type LIKE 'image/%'), file_size BIGINT NOT NULL CHECK (file_size > 0), @@ -12,7 +12,7 @@ CREATE TABLE images ( height INT CHECK (height > 0), -- 业务元数据 - category_id UUID, -- 分类服务提供的UUID + category_id VARCHAR(36), -- 分类服务提供的UUID tags TEXT[] DEFAULT '{}'::TEXT[], -- 系统管控字段