提供根据ID获取管理员信息
CI / changes (push) Successful in 13s
CI / docker-bff (push) Successful in 2s
CI / docker-product (push) Has been skipped
CI / docker-admin (push) Successful in 31s
CI / docker-user (push) Has been skipped
CI / docker-ad (push) Has been skipped
CI / docker-chore (push) Has been skipped
CI / docker-express (push) Has been skipped
CI / docker-sale (push) Has been skipped

This commit is contained in:
2026-08-28 18:10:34 +08:00
parent 23ea6659c2
commit 2a6cd21ec4
8 changed files with 438 additions and 127 deletions
Binary file not shown.
+16
View File
@@ -125,6 +125,20 @@ message RoleRuleRequest {
string rule = 2;
}
message AdminNamesByIdsRequest {
repeated int64 ids = 1;
}
message NamesItem {
int64 id = 1;
string name = 2;
}
message AdminNamesByIdsResponse {
repeated NamesItem items = 1;
}
message RoleNameRequest {
string name = 1;
int64 service_id = 2;
@@ -332,4 +346,6 @@ service Admin {
body: "*"
};
};
//传入IDS []int64,返回[]NamesItem{id int64,name string}
rpc AdminNamesByIds(AdminNamesByIdsRequest) returns(AdminNamesByIdsResponse);
}
+258 -104
View File
@@ -1238,6 +1238,146 @@ func (x *RoleRuleRequest) GetRule() string {
return ""
}
type AdminNamesByIdsRequest struct {
state protoimpl.MessageState `protogen:"open.v1"`
Ids []int64 `protobuf:"varint,1,rep,packed,name=ids,proto3" json:"ids,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *AdminNamesByIdsRequest) Reset() {
*x = AdminNamesByIdsRequest{}
mi := &file_admin_admin_proto_msgTypes[20]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *AdminNamesByIdsRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*AdminNamesByIdsRequest) ProtoMessage() {}
func (x *AdminNamesByIdsRequest) ProtoReflect() protoreflect.Message {
mi := &file_admin_admin_proto_msgTypes[20]
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 AdminNamesByIdsRequest.ProtoReflect.Descriptor instead.
func (*AdminNamesByIdsRequest) Descriptor() ([]byte, []int) {
return file_admin_admin_proto_rawDescGZIP(), []int{20}
}
func (x *AdminNamesByIdsRequest) GetIds() []int64 {
if x != nil {
return x.Ids
}
return nil
}
type NamesItem struct {
state protoimpl.MessageState `protogen:"open.v1"`
Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *NamesItem) Reset() {
*x = NamesItem{}
mi := &file_admin_admin_proto_msgTypes[21]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *NamesItem) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*NamesItem) ProtoMessage() {}
func (x *NamesItem) ProtoReflect() protoreflect.Message {
mi := &file_admin_admin_proto_msgTypes[21]
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 NamesItem.ProtoReflect.Descriptor instead.
func (*NamesItem) Descriptor() ([]byte, []int) {
return file_admin_admin_proto_rawDescGZIP(), []int{21}
}
func (x *NamesItem) GetId() int64 {
if x != nil {
return x.Id
}
return 0
}
func (x *NamesItem) GetName() string {
if x != nil {
return x.Name
}
return ""
}
type AdminNamesByIdsResponse struct {
state protoimpl.MessageState `protogen:"open.v1"`
Items []*NamesItem `protobuf:"bytes,1,rep,name=items,proto3" json:"items,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *AdminNamesByIdsResponse) Reset() {
*x = AdminNamesByIdsResponse{}
mi := &file_admin_admin_proto_msgTypes[22]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *AdminNamesByIdsResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*AdminNamesByIdsResponse) ProtoMessage() {}
func (x *AdminNamesByIdsResponse) ProtoReflect() protoreflect.Message {
mi := &file_admin_admin_proto_msgTypes[22]
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 AdminNamesByIdsResponse.ProtoReflect.Descriptor instead.
func (*AdminNamesByIdsResponse) Descriptor() ([]byte, []int) {
return file_admin_admin_proto_rawDescGZIP(), []int{22}
}
func (x *AdminNamesByIdsResponse) GetItems() []*NamesItem {
if x != nil {
return x.Items
}
return nil
}
type RoleNameRequest struct {
state protoimpl.MessageState `protogen:"open.v1"`
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
@@ -1248,7 +1388,7 @@ type RoleNameRequest struct {
func (x *RoleNameRequest) Reset() {
*x = RoleNameRequest{}
mi := &file_admin_admin_proto_msgTypes[20]
mi := &file_admin_admin_proto_msgTypes[23]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -1260,7 +1400,7 @@ func (x *RoleNameRequest) String() string {
func (*RoleNameRequest) ProtoMessage() {}
func (x *RoleNameRequest) ProtoReflect() protoreflect.Message {
mi := &file_admin_admin_proto_msgTypes[20]
mi := &file_admin_admin_proto_msgTypes[23]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -1273,7 +1413,7 @@ func (x *RoleNameRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use RoleNameRequest.ProtoReflect.Descriptor instead.
func (*RoleNameRequest) Descriptor() ([]byte, []int) {
return file_admin_admin_proto_rawDescGZIP(), []int{20}
return file_admin_admin_proto_rawDescGZIP(), []int{23}
}
func (x *RoleNameRequest) GetName() string {
@@ -1302,7 +1442,7 @@ type RoleEditRequest struct {
func (x *RoleEditRequest) Reset() {
*x = RoleEditRequest{}
mi := &file_admin_admin_proto_msgTypes[21]
mi := &file_admin_admin_proto_msgTypes[24]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -1314,7 +1454,7 @@ func (x *RoleEditRequest) String() string {
func (*RoleEditRequest) ProtoMessage() {}
func (x *RoleEditRequest) ProtoReflect() protoreflect.Message {
mi := &file_admin_admin_proto_msgTypes[21]
mi := &file_admin_admin_proto_msgTypes[24]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -1327,7 +1467,7 @@ func (x *RoleEditRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use RoleEditRequest.ProtoReflect.Descriptor instead.
func (*RoleEditRequest) Descriptor() ([]byte, []int) {
return file_admin_admin_proto_rawDescGZIP(), []int{21}
return file_admin_admin_proto_rawDescGZIP(), []int{24}
}
func (x *RoleEditRequest) GetId() int64 {
@@ -1371,7 +1511,7 @@ type RoleItemsRequest struct {
func (x *RoleItemsRequest) Reset() {
*x = RoleItemsRequest{}
mi := &file_admin_admin_proto_msgTypes[22]
mi := &file_admin_admin_proto_msgTypes[25]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -1383,7 +1523,7 @@ func (x *RoleItemsRequest) String() string {
func (*RoleItemsRequest) ProtoMessage() {}
func (x *RoleItemsRequest) ProtoReflect() protoreflect.Message {
mi := &file_admin_admin_proto_msgTypes[22]
mi := &file_admin_admin_proto_msgTypes[25]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -1396,7 +1536,7 @@ func (x *RoleItemsRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use RoleItemsRequest.ProtoReflect.Descriptor instead.
func (*RoleItemsRequest) Descriptor() ([]byte, []int) {
return file_admin_admin_proto_rawDescGZIP(), []int{22}
return file_admin_admin_proto_rawDescGZIP(), []int{25}
}
func (x *RoleItemsRequest) GetPage() int32 {
@@ -1525,7 +1665,14 @@ const file_admin_admin_proto_rawDesc = "" +
"\x11data_tree_oneself\x18\x13 \x01(\tR\x0fdataTreeOneself\"5\n" +
"\x0fRoleRuleRequest\x12\x0e\n" +
"\x02id\x18\x01 \x01(\x03R\x02id\x12\x12\n" +
"\x04rule\x18\x02 \x01(\tR\x04rule\"D\n" +
"\x04rule\x18\x02 \x01(\tR\x04rule\"*\n" +
"\x16AdminNamesByIdsRequest\x12\x10\n" +
"\x03ids\x18\x01 \x03(\x03R\x03ids\"/\n" +
"\tNamesItem\x12\x0e\n" +
"\x02id\x18\x01 \x01(\x03R\x02id\x12\x12\n" +
"\x04name\x18\x02 \x01(\tR\x04name\"A\n" +
"\x17AdminNamesByIdsResponse\x12&\n" +
"\x05items\x18\x01 \x03(\v2\x10.admin.NamesItemR\x05items\"D\n" +
"\x0fRoleNameRequest\x12\x12\n" +
"\x04name\x18\x01 \x01(\tR\x04name\x12\x1d\n" +
"\n" +
@@ -1542,7 +1689,7 @@ const file_admin_admin_proto_rawDesc = "" +
"\n" +
"service_id\x18\x03 \x01(\x03R\tserviceId\x12\x12\n" +
"\x04name\x18\x04 \x01(\tR\x04name\x12\x16\n" +
"\x06status\x18\x05 \x01(\x05R\x06status2\x82\x16\n" +
"\x06status\x18\x05 \x01(\x05R\x06status2\xd4\x16\n" +
"\x05Admin\x12V\n" +
"\tAdminEdit\x12\x17.admin.AdminEditRequest\x1a\x0f.admin.Response\"\x1f\x82\xd3\xe4\x93\x02\x19:\x01*\"\x14/admin/v3/admin/edit\x12W\n" +
"\vAdminStatus\x12\x14.admin.StatusRequest\x1a\x0f.admin.Response\"!\x82\xd3\xe4\x93\x02\x1b:\x01*\"\x16/admin/v3/admin/status\x12X\n" +
@@ -1578,7 +1725,8 @@ const file_admin_admin_proto_rawDesc = "" +
"\tRoleItems\x12\x17.admin.RoleItemsRequest\x1a\x0f.admin.Response\"\x1f\x82\xd3\xe4\x93\x02\x19:\x01*\x12\x14/admin/v3/role/items\x12U\n" +
"\n" +
"RoleStatus\x12\x14.admin.StatusRequest\x1a\x0f.admin.Response\" \x82\xd3\xe4\x93\x02\x1a:\x01*\"\x15/admin/v3/role/status\x12S\n" +
"\bRoleRule\x12\x16.admin.RoleRuleRequest\x1a\x0f.admin.Response\"\x1e\x82\xd3\xe4\x93\x02\x18:\x01*\"\x13/admin/v3/role/ruleB\x19Z\x17lone-services/rpc/adminb\x06proto3"
"\bRoleRule\x12\x16.admin.RoleRuleRequest\x1a\x0f.admin.Response\"\x1e\x82\xd3\xe4\x93\x02\x18:\x01*\"\x13/admin/v3/role/rule\x12P\n" +
"\x0fAdminNamesByIds\x12\x1d.admin.AdminNamesByIdsRequest\x1a\x1e.admin.AdminNamesByIdsResponseB\x19Z\x17lone-services/rpc/adminb\x06proto3"
var (
file_admin_admin_proto_rawDescOnce sync.Once
@@ -1592,100 +1740,106 @@ func file_admin_admin_proto_rawDescGZIP() []byte {
return file_admin_admin_proto_rawDescData
}
var file_admin_admin_proto_msgTypes = make([]protoimpl.MessageInfo, 23)
var file_admin_admin_proto_msgTypes = make([]protoimpl.MessageInfo, 26)
var file_admin_admin_proto_goTypes = []any{
(*AdminEditRequest)(nil), // 0: admin.AdminEditRequest
(*StatusRequest)(nil), // 1: admin.StatusRequest
(*Response)(nil), // 2: admin.Response
(*PasswordRequest)(nil), // 3: admin.PasswordRequest
(*OwnPasswordRequest)(nil), // 4: admin.OwnPasswordRequest
(*AdminInfoRequest)(nil), // 5: admin.AdminInfoRequest
(*AdminItemsRequest)(nil), // 6: admin.AdminItemsRequest
(*LoginRequest)(nil), // 7: admin.LoginRequest
(*AdminEmptyRequest)(nil), // 8: admin.AdminEmptyRequest
(*InfoRequest)(nil), // 9: admin.InfoRequest
(*LoginKickedOutRequest)(nil), // 10: admin.LoginKickedOutRequest
(*ServiceEditRequest)(nil), // 11: admin.ServiceEditRequest
(*ServiceItemsRequest)(nil), // 12: admin.ServiceItemsRequest
(*ServiceNameRequest)(nil), // 13: admin.ServiceNameRequest
(*AuthoritySortRequest)(nil), // 14: admin.AuthoritySortRequest
(*AuthorityNameRequest)(nil), // 15: admin.AuthorityNameRequest
(*AuthorityItemsRequest)(nil), // 16: admin.AuthorityItemsRequest
(*RoutesRequest)(nil), // 17: admin.RoutesRequest
(*AuthorityEditRequest)(nil), // 18: admin.AuthorityEditRequest
(*RoleRuleRequest)(nil), // 19: admin.RoleRuleRequest
(*RoleNameRequest)(nil), // 20: admin.RoleNameRequest
(*RoleEditRequest)(nil), // 21: admin.RoleEditRequest
(*RoleItemsRequest)(nil), // 22: admin.RoleItemsRequest
(*AdminEditRequest)(nil), // 0: admin.AdminEditRequest
(*StatusRequest)(nil), // 1: admin.StatusRequest
(*Response)(nil), // 2: admin.Response
(*PasswordRequest)(nil), // 3: admin.PasswordRequest
(*OwnPasswordRequest)(nil), // 4: admin.OwnPasswordRequest
(*AdminInfoRequest)(nil), // 5: admin.AdminInfoRequest
(*AdminItemsRequest)(nil), // 6: admin.AdminItemsRequest
(*LoginRequest)(nil), // 7: admin.LoginRequest
(*AdminEmptyRequest)(nil), // 8: admin.AdminEmptyRequest
(*InfoRequest)(nil), // 9: admin.InfoRequest
(*LoginKickedOutRequest)(nil), // 10: admin.LoginKickedOutRequest
(*ServiceEditRequest)(nil), // 11: admin.ServiceEditRequest
(*ServiceItemsRequest)(nil), // 12: admin.ServiceItemsRequest
(*ServiceNameRequest)(nil), // 13: admin.ServiceNameRequest
(*AuthoritySortRequest)(nil), // 14: admin.AuthoritySortRequest
(*AuthorityNameRequest)(nil), // 15: admin.AuthorityNameRequest
(*AuthorityItemsRequest)(nil), // 16: admin.AuthorityItemsRequest
(*RoutesRequest)(nil), // 17: admin.RoutesRequest
(*AuthorityEditRequest)(nil), // 18: admin.AuthorityEditRequest
(*RoleRuleRequest)(nil), // 19: admin.RoleRuleRequest
(*AdminNamesByIdsRequest)(nil), // 20: admin.AdminNamesByIdsRequest
(*NamesItem)(nil), // 21: admin.NamesItem
(*AdminNamesByIdsResponse)(nil), // 22: admin.AdminNamesByIdsResponse
(*RoleNameRequest)(nil), // 23: admin.RoleNameRequest
(*RoleEditRequest)(nil), // 24: admin.RoleEditRequest
(*RoleItemsRequest)(nil), // 25: admin.RoleItemsRequest
}
var file_admin_admin_proto_depIdxs = []int32{
0, // 0: admin.Admin.AdminEdit:input_type -> admin.AdminEditRequest
1, // 1: admin.Admin.AdminStatus:input_type -> admin.StatusRequest
3, // 2: admin.Admin.Password:input_type -> admin.PasswordRequest
4, // 3: admin.Admin.OwnPassword:input_type -> admin.OwnPasswordRequest
5, // 4: admin.Admin.AdminInfo:input_type -> admin.AdminInfoRequest
6, // 5: admin.Admin.AdminItems:input_type -> admin.AdminItemsRequest
8, // 6: admin.Admin.AdminNames:input_type -> admin.AdminEmptyRequest
8, // 7: admin.Admin.LoginRefresh:input_type -> admin.AdminEmptyRequest
7, // 8: admin.Admin.Login:input_type -> admin.LoginRequest
8, // 9: admin.Admin.LoginInfo:input_type -> admin.AdminEmptyRequest
8, // 10: admin.Admin.LoginItems:input_type -> admin.AdminEmptyRequest
10, // 11: admin.Admin.LoginKickedOut:input_type -> admin.LoginKickedOutRequest
8, // 12: admin.Admin.LogOut:input_type -> admin.AdminEmptyRequest
17, // 13: admin.Admin.LoginRoutes:input_type -> admin.RoutesRequest
9, // 14: admin.Admin.ServiceInfo:input_type -> admin.InfoRequest
11, // 15: admin.Admin.ServiceEdit:input_type -> admin.ServiceEditRequest
12, // 16: admin.Admin.ServiceItems:input_type -> admin.ServiceItemsRequest
1, // 17: admin.Admin.ServiceStatus:input_type -> admin.StatusRequest
13, // 18: admin.Admin.ServiceNames:input_type -> admin.ServiceNameRequest
9, // 19: admin.Admin.AuthorityInfo:input_type -> admin.InfoRequest
18, // 20: admin.Admin.AuthorityEdit:input_type -> admin.AuthorityEditRequest
16, // 21: admin.Admin.AuthorityItems:input_type -> admin.AuthorityItemsRequest
1, // 22: admin.Admin.AuthorityStatus:input_type -> admin.StatusRequest
15, // 23: admin.Admin.AuthorityNames:input_type -> admin.AuthorityNameRequest
14, // 24: admin.Admin.AuthoritySort:input_type -> admin.AuthoritySortRequest
20, // 25: admin.Admin.RoleNames:input_type -> admin.RoleNameRequest
9, // 26: admin.Admin.RoleInfo:input_type -> admin.InfoRequest
21, // 27: admin.Admin.RoleEdit:input_type -> admin.RoleEditRequest
22, // 28: admin.Admin.RoleItems:input_type -> admin.RoleItemsRequest
1, // 29: admin.Admin.RoleStatus:input_type -> admin.StatusRequest
19, // 30: admin.Admin.RoleRule:input_type -> admin.RoleRuleRequest
2, // 31: admin.Admin.AdminEdit:output_type -> admin.Response
2, // 32: admin.Admin.AdminStatus:output_type -> admin.Response
2, // 33: admin.Admin.Password:output_type -> admin.Response
2, // 34: admin.Admin.OwnPassword:output_type -> admin.Response
2, // 35: admin.Admin.AdminInfo:output_type -> admin.Response
2, // 36: admin.Admin.AdminItems:output_type -> admin.Response
2, // 37: admin.Admin.AdminNames:output_type -> admin.Response
2, // 38: admin.Admin.LoginRefresh:output_type -> admin.Response
2, // 39: admin.Admin.Login:output_type -> admin.Response
2, // 40: admin.Admin.LoginInfo:output_type -> admin.Response
2, // 41: admin.Admin.LoginItems:output_type -> admin.Response
2, // 42: admin.Admin.LoginKickedOut:output_type -> admin.Response
2, // 43: admin.Admin.LogOut:output_type -> admin.Response
2, // 44: admin.Admin.LoginRoutes:output_type -> admin.Response
2, // 45: admin.Admin.ServiceInfo:output_type -> admin.Response
2, // 46: admin.Admin.ServiceEdit:output_type -> admin.Response
2, // 47: admin.Admin.ServiceItems:output_type -> admin.Response
2, // 48: admin.Admin.ServiceStatus:output_type -> admin.Response
2, // 49: admin.Admin.ServiceNames:output_type -> admin.Response
2, // 50: admin.Admin.AuthorityInfo:output_type -> admin.Response
2, // 51: admin.Admin.AuthorityEdit:output_type -> admin.Response
2, // 52: admin.Admin.AuthorityItems:output_type -> admin.Response
2, // 53: admin.Admin.AuthorityStatus:output_type -> admin.Response
2, // 54: admin.Admin.AuthorityNames:output_type -> admin.Response
2, // 55: admin.Admin.AuthoritySort:output_type -> admin.Response
2, // 56: admin.Admin.RoleNames:output_type -> admin.Response
2, // 57: admin.Admin.RoleInfo:output_type -> admin.Response
2, // 58: admin.Admin.RoleEdit:output_type -> admin.Response
2, // 59: admin.Admin.RoleItems:output_type -> admin.Response
2, // 60: admin.Admin.RoleStatus:output_type -> admin.Response
2, // 61: admin.Admin.RoleRule:output_type -> admin.Response
31, // [31:62] is the sub-list for method output_type
0, // [0:31] is the sub-list for method input_type
0, // [0:0] is the sub-list for extension type_name
0, // [0:0] is the sub-list for extension extendee
0, // [0:0] is the sub-list for field type_name
21, // 0: admin.AdminNamesByIdsResponse.items:type_name -> admin.NamesItem
0, // 1: admin.Admin.AdminEdit:input_type -> admin.AdminEditRequest
1, // 2: admin.Admin.AdminStatus:input_type -> admin.StatusRequest
3, // 3: admin.Admin.Password:input_type -> admin.PasswordRequest
4, // 4: admin.Admin.OwnPassword:input_type -> admin.OwnPasswordRequest
5, // 5: admin.Admin.AdminInfo:input_type -> admin.AdminInfoRequest
6, // 6: admin.Admin.AdminItems:input_type -> admin.AdminItemsRequest
8, // 7: admin.Admin.AdminNames:input_type -> admin.AdminEmptyRequest
8, // 8: admin.Admin.LoginRefresh:input_type -> admin.AdminEmptyRequest
7, // 9: admin.Admin.Login:input_type -> admin.LoginRequest
8, // 10: admin.Admin.LoginInfo:input_type -> admin.AdminEmptyRequest
8, // 11: admin.Admin.LoginItems:input_type -> admin.AdminEmptyRequest
10, // 12: admin.Admin.LoginKickedOut:input_type -> admin.LoginKickedOutRequest
8, // 13: admin.Admin.LogOut:input_type -> admin.AdminEmptyRequest
17, // 14: admin.Admin.LoginRoutes:input_type -> admin.RoutesRequest
9, // 15: admin.Admin.ServiceInfo:input_type -> admin.InfoRequest
11, // 16: admin.Admin.ServiceEdit:input_type -> admin.ServiceEditRequest
12, // 17: admin.Admin.ServiceItems:input_type -> admin.ServiceItemsRequest
1, // 18: admin.Admin.ServiceStatus:input_type -> admin.StatusRequest
13, // 19: admin.Admin.ServiceNames:input_type -> admin.ServiceNameRequest
9, // 20: admin.Admin.AuthorityInfo:input_type -> admin.InfoRequest
18, // 21: admin.Admin.AuthorityEdit:input_type -> admin.AuthorityEditRequest
16, // 22: admin.Admin.AuthorityItems:input_type -> admin.AuthorityItemsRequest
1, // 23: admin.Admin.AuthorityStatus:input_type -> admin.StatusRequest
15, // 24: admin.Admin.AuthorityNames:input_type -> admin.AuthorityNameRequest
14, // 25: admin.Admin.AuthoritySort:input_type -> admin.AuthoritySortRequest
23, // 26: admin.Admin.RoleNames:input_type -> admin.RoleNameRequest
9, // 27: admin.Admin.RoleInfo:input_type -> admin.InfoRequest
24, // 28: admin.Admin.RoleEdit:input_type -> admin.RoleEditRequest
25, // 29: admin.Admin.RoleItems:input_type -> admin.RoleItemsRequest
1, // 30: admin.Admin.RoleStatus:input_type -> admin.StatusRequest
19, // 31: admin.Admin.RoleRule:input_type -> admin.RoleRuleRequest
20, // 32: admin.Admin.AdminNamesByIds:input_type -> admin.AdminNamesByIdsRequest
2, // 33: admin.Admin.AdminEdit:output_type -> admin.Response
2, // 34: admin.Admin.AdminStatus:output_type -> admin.Response
2, // 35: admin.Admin.Password:output_type -> admin.Response
2, // 36: admin.Admin.OwnPassword:output_type -> admin.Response
2, // 37: admin.Admin.AdminInfo:output_type -> admin.Response
2, // 38: admin.Admin.AdminItems:output_type -> admin.Response
2, // 39: admin.Admin.AdminNames:output_type -> admin.Response
2, // 40: admin.Admin.LoginRefresh:output_type -> admin.Response
2, // 41: admin.Admin.Login:output_type -> admin.Response
2, // 42: admin.Admin.LoginInfo:output_type -> admin.Response
2, // 43: admin.Admin.LoginItems:output_type -> admin.Response
2, // 44: admin.Admin.LoginKickedOut:output_type -> admin.Response
2, // 45: admin.Admin.LogOut:output_type -> admin.Response
2, // 46: admin.Admin.LoginRoutes:output_type -> admin.Response
2, // 47: admin.Admin.ServiceInfo:output_type -> admin.Response
2, // 48: admin.Admin.ServiceEdit:output_type -> admin.Response
2, // 49: admin.Admin.ServiceItems:output_type -> admin.Response
2, // 50: admin.Admin.ServiceStatus:output_type -> admin.Response
2, // 51: admin.Admin.ServiceNames:output_type -> admin.Response
2, // 52: admin.Admin.AuthorityInfo:output_type -> admin.Response
2, // 53: admin.Admin.AuthorityEdit:output_type -> admin.Response
2, // 54: admin.Admin.AuthorityItems:output_type -> admin.Response
2, // 55: admin.Admin.AuthorityStatus:output_type -> admin.Response
2, // 56: admin.Admin.AuthorityNames:output_type -> admin.Response
2, // 57: admin.Admin.AuthoritySort:output_type -> admin.Response
2, // 58: admin.Admin.RoleNames:output_type -> admin.Response
2, // 59: admin.Admin.RoleInfo:output_type -> admin.Response
2, // 60: admin.Admin.RoleEdit:output_type -> admin.Response
2, // 61: admin.Admin.RoleItems:output_type -> admin.Response
2, // 62: admin.Admin.RoleStatus:output_type -> admin.Response
2, // 63: admin.Admin.RoleRule:output_type -> admin.Response
22, // 64: admin.Admin.AdminNamesByIds:output_type -> admin.AdminNamesByIdsResponse
33, // [33:65] is the sub-list for method output_type
1, // [1:33] is the sub-list for method input_type
1, // [1:1] is the sub-list for extension type_name
1, // [1:1] is the sub-list for extension extendee
0, // [0:1] is the sub-list for field type_name
}
func init() { file_admin_admin_proto_init() }
@@ -1699,7 +1853,7 @@ func file_admin_admin_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: unsafe.Slice(unsafe.StringData(file_admin_admin_proto_rawDesc), len(file_admin_admin_proto_rawDesc)),
NumEnums: 0,
NumMessages: 23,
NumMessages: 26,
NumExtensions: 0,
NumServices: 1,
},
+40
View File
@@ -50,6 +50,7 @@ const (
Admin_RoleItems_FullMethodName = "/admin.Admin/RoleItems"
Admin_RoleStatus_FullMethodName = "/admin.Admin/RoleStatus"
Admin_RoleRule_FullMethodName = "/admin.Admin/RoleRule"
Admin_AdminNamesByIds_FullMethodName = "/admin.Admin/AdminNamesByIds"
)
// AdminClient is the client API for Admin service.
@@ -87,6 +88,8 @@ type AdminClient interface {
RoleItems(ctx context.Context, in *RoleItemsRequest, opts ...grpc.CallOption) (*Response, error)
RoleStatus(ctx context.Context, in *StatusRequest, opts ...grpc.CallOption) (*Response, error)
RoleRule(ctx context.Context, in *RoleRuleRequest, opts ...grpc.CallOption) (*Response, error)
// 传入IDS []int64,返回[]NamesItem{id int64,name string}
AdminNamesByIds(ctx context.Context, in *AdminNamesByIdsRequest, opts ...grpc.CallOption) (*AdminNamesByIdsResponse, error)
}
type adminClient struct {
@@ -407,6 +410,16 @@ func (c *adminClient) RoleRule(ctx context.Context, in *RoleRuleRequest, opts ..
return out, nil
}
func (c *adminClient) AdminNamesByIds(ctx context.Context, in *AdminNamesByIdsRequest, opts ...grpc.CallOption) (*AdminNamesByIdsResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(AdminNamesByIdsResponse)
err := c.cc.Invoke(ctx, Admin_AdminNamesByIds_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
// AdminServer is the server API for Admin service.
// All implementations must embed UnimplementedAdminServer
// for forward compatibility.
@@ -442,6 +455,8 @@ type AdminServer interface {
RoleItems(context.Context, *RoleItemsRequest) (*Response, error)
RoleStatus(context.Context, *StatusRequest) (*Response, error)
RoleRule(context.Context, *RoleRuleRequest) (*Response, error)
// 传入IDS []int64,返回[]NamesItem{id int64,name string}
AdminNamesByIds(context.Context, *AdminNamesByIdsRequest) (*AdminNamesByIdsResponse, error)
mustEmbedUnimplementedAdminServer()
}
@@ -545,6 +560,9 @@ func (UnimplementedAdminServer) RoleStatus(context.Context, *StatusRequest) (*Re
func (UnimplementedAdminServer) RoleRule(context.Context, *RoleRuleRequest) (*Response, error) {
return nil, status.Error(codes.Unimplemented, "method RoleRule not implemented")
}
func (UnimplementedAdminServer) AdminNamesByIds(context.Context, *AdminNamesByIdsRequest) (*AdminNamesByIdsResponse, error) {
return nil, status.Error(codes.Unimplemented, "method AdminNamesByIds not implemented")
}
func (UnimplementedAdminServer) mustEmbedUnimplementedAdminServer() {}
func (UnimplementedAdminServer) testEmbeddedByValue() {}
@@ -1124,6 +1142,24 @@ func _Admin_RoleRule_Handler(srv interface{}, ctx context.Context, dec func(inte
return interceptor(ctx, in, info, handler)
}
func _Admin_AdminNamesByIds_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(AdminNamesByIdsRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(AdminServer).AdminNamesByIds(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Admin_AdminNamesByIds_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(AdminServer).AdminNamesByIds(ctx, req.(*AdminNamesByIdsRequest))
}
return interceptor(ctx, in, info, handler)
}
// Admin_ServiceDesc is the grpc.ServiceDesc for Admin service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
@@ -1255,6 +1291,10 @@ var Admin_ServiceDesc = grpc.ServiceDesc{
MethodName: "RoleRule",
Handler: _Admin_RoleRule_Handler,
},
{
MethodName: "AdminNamesByIds",
Handler: _Admin_AdminNamesByIds_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "admin/admin.proto",
+34 -23
View File
@@ -14,29 +14,32 @@ import (
)
type (
AdminEditRequest = admin.AdminEditRequest
AdminEmptyRequest = admin.AdminEmptyRequest
AdminInfoRequest = admin.AdminInfoRequest
AdminItemsRequest = admin.AdminItemsRequest
AuthorityEditRequest = admin.AuthorityEditRequest
AuthorityItemsRequest = admin.AuthorityItemsRequest
AuthorityNameRequest = admin.AuthorityNameRequest
AuthoritySortRequest = admin.AuthoritySortRequest
InfoRequest = admin.InfoRequest
LoginKickedOutRequest = admin.LoginKickedOutRequest
LoginRequest = admin.LoginRequest
OwnPasswordRequest = admin.OwnPasswordRequest
PasswordRequest = admin.PasswordRequest
Response = admin.Response
RoleEditRequest = admin.RoleEditRequest
RoleItemsRequest = admin.RoleItemsRequest
RoleNameRequest = admin.RoleNameRequest
RoleRuleRequest = admin.RoleRuleRequest
RoutesRequest = admin.RoutesRequest
ServiceEditRequest = admin.ServiceEditRequest
ServiceItemsRequest = admin.ServiceItemsRequest
ServiceNameRequest = admin.ServiceNameRequest
StatusRequest = admin.StatusRequest
AdminEditRequest = admin.AdminEditRequest
AdminEmptyRequest = admin.AdminEmptyRequest
AdminInfoRequest = admin.AdminInfoRequest
AdminItemsRequest = admin.AdminItemsRequest
AdminNamesByIdsRequest = admin.AdminNamesByIdsRequest
AdminNamesByIdsResponse = admin.AdminNamesByIdsResponse
AuthorityEditRequest = admin.AuthorityEditRequest
AuthorityItemsRequest = admin.AuthorityItemsRequest
AuthorityNameRequest = admin.AuthorityNameRequest
AuthoritySortRequest = admin.AuthoritySortRequest
InfoRequest = admin.InfoRequest
LoginKickedOutRequest = admin.LoginKickedOutRequest
LoginRequest = admin.LoginRequest
NamesItem = admin.NamesItem
OwnPasswordRequest = admin.OwnPasswordRequest
PasswordRequest = admin.PasswordRequest
Response = admin.Response
RoleEditRequest = admin.RoleEditRequest
RoleItemsRequest = admin.RoleItemsRequest
RoleNameRequest = admin.RoleNameRequest
RoleRuleRequest = admin.RoleRuleRequest
RoutesRequest = admin.RoutesRequest
ServiceEditRequest = admin.ServiceEditRequest
ServiceItemsRequest = admin.ServiceItemsRequest
ServiceNameRequest = admin.ServiceNameRequest
StatusRequest = admin.StatusRequest
Admin interface {
AdminEdit(ctx context.Context, in *AdminEditRequest, opts ...grpc.CallOption) (*Response, error)
@@ -70,6 +73,8 @@ type (
RoleItems(ctx context.Context, in *RoleItemsRequest, opts ...grpc.CallOption) (*Response, error)
RoleStatus(ctx context.Context, in *StatusRequest, opts ...grpc.CallOption) (*Response, error)
RoleRule(ctx context.Context, in *RoleRuleRequest, opts ...grpc.CallOption) (*Response, error)
// 传入IDS []int64,返回[]NamesItem{id int64,name string}
AdminNamesByIds(ctx context.Context, in *AdminNamesByIdsRequest, opts ...grpc.CallOption) (*AdminNamesByIdsResponse, error)
}
defaultAdmin struct {
@@ -237,3 +242,9 @@ func (m *defaultAdmin) RoleRule(ctx context.Context, in *RoleRuleRequest, opts .
client := admin.NewAdminClient(m.cli.Conn())
return client.RoleRule(ctx, in, opts...)
}
// 传入IDS []int64,返回[]NamesItem{id int64,name string}
func (m *defaultAdmin) AdminNamesByIds(ctx context.Context, in *AdminNamesByIdsRequest, opts ...grpc.CallOption) (*AdminNamesByIdsResponse, error) {
client := admin.NewAdminClient(m.cli.Conn())
return client.AdminNamesByIds(ctx, in, opts...)
}
@@ -0,0 +1,73 @@
package logic
import (
"context"
"lone-services/pkg/modelbase"
"lone-services/pkg/utils"
"lone-services/pkg/validate"
"lone-services/services/admin/internal/dao"
"lone-services/services/admin/internal/model"
"lone-services/services/admin/validator"
"strconv"
"lone-services/rpc/admin/pb"
"lone-services/services/admin/internal/svc"
"github.com/zeromicro/go-zero/core/logx"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
)
type AdminNamesByIdsLogic struct {
ctx context.Context
svcCtx *svc.ServiceContext
logx.Logger
}
func NewAdminNamesByIdsLogic(ctx context.Context, svcCtx *svc.ServiceContext) *AdminNamesByIdsLogic {
return &AdminNamesByIdsLogic{
ctx: ctx,
svcCtx: svcCtx,
Logger: logx.WithContext(ctx),
}
}
// 传入IDS []int64,返回[]NamesItem{id int64,name string}
func (l *AdminNamesByIdsLogic) AdminNamesByIds(in *admin.AdminNamesByIdsRequest) (*admin.AdminNamesByIdsResponse, error) {
var req validator.AdminNamesByIdsValidator
if msg := validate.ValidateFromProto(in, &req); msg != utils.StringEmpty {
return nil, status.Error(codes.InvalidArgument, msg)
}
ids := make([]string, utils.NumberZero, len(in.Ids))
for _, id := range in.Ids {
ids = append(ids, strconv.FormatInt(id, utils.NumberTen))
}
w := modelbase.Params{
In: map[string][]string{"id in ?": ids},
Eq: map[string]string{"status": utils.StringStatusOk},
}
var items []dao.AdminNames
err := model.AdminModel{}.Init().Items(w, &items)
if err != nil {
l.Logger.Error(err)
return nil, status.Error(codes.Code(utils.Fail.Code), utils.Fail.Msg)
}
if len(items) < utils.NumberOne {
return nil, status.Error(codes.Code(utils.ErrorNotFund.Code), utils.ErrorNotFund.Msg)
}
var result []*admin.NamesItem
for item := range items {
mobile, dErr := utils.DecryptPhone(items[item].Phone)
if dErr == nil {
items[item].Phone = mobile
}
result = append(result, &admin.NamesItem{
Id: int64(items[item].Id),
Name: items[item].Name,
})
}
return &admin.AdminNamesByIdsResponse{Items: result}, nil
}
@@ -177,3 +177,9 @@ func (s *AdminServer) RoleRule(ctx context.Context, in *admin.RoleRuleRequest) (
l := logic.NewRoleRuleLogic(ctx, s.svcCtx)
return l.RoleRule(in)
}
// 传入IDS []int64,返回[]NamesItem{id int64,name string}
func (s *AdminServer) AdminNamesByIds(ctx context.Context, in *admin.AdminNamesByIdsRequest) (*admin.AdminNamesByIdsResponse, error) {
l := logic.NewAdminNamesByIdsLogic(ctx, s.svcCtx)
return l.AdminNamesByIds(in)
}
+11
View File
@@ -135,3 +135,14 @@ func (p LoginKickedOutValidator) GetMessage() validate.ValidatorMessages {
"Id.required": "ID不能为空",
}
}
type AdminNamesByIdsValidator struct {
Ids []int64 `validate:"required"`
}
// GetMessage 提示消息
func (p AdminNamesByIdsValidator) GetMessage() validate.ValidatorMessages {
return validate.ValidatorMessages{
"Ids.required": "ID不能为空",
}
}