add admin names api
This commit is contained in:
+64
-60
@@ -1524,7 +1524,7 @@ const file_proto_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\xa7\x15\n" +
|
||||
"\x06status\x18\x05 \x01(\x05R\x06status2\x82\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" +
|
||||
@@ -1532,12 +1532,14 @@ const file_proto_admin_proto_rawDesc = "" +
|
||||
"\vOwnPassword\x12\x19.admin.OwnPasswordRequest\x1a\x0f.admin.Response\"'\x82\xd3\xe4\x93\x02!:\x01*\"\x1c/admin/v3/admin/own-password\x12V\n" +
|
||||
"\tAdminInfo\x12\x17.admin.AdminInfoRequest\x1a\x0f.admin.Response\"\x1f\x82\xd3\xe4\x93\x02\x19:\x01*\x12\x14/admin/v3/admin/info\x12Y\n" +
|
||||
"\n" +
|
||||
"AdminItems\x12\x18.admin.AdminItemsRequest\x1a\x0f.admin.Response\" \x82\xd3\xe4\x93\x02\x1a:\x01*\x12\x15/admin/v3/admin/items\x12W\n" +
|
||||
"AdminItems\x12\x18.admin.AdminItemsRequest\x1a\x0f.admin.Response\" \x82\xd3\xe4\x93\x02\x1a:\x01*\x12\x15/admin/v3/admin/items\x12Y\n" +
|
||||
"\n" +
|
||||
"AdminNames\x12\x18.admin.AdminEmptyRequest\x1a\x0f.admin.Response\" \x82\xd3\xe4\x93\x02\x1a:\x01*\x12\x15/admin/v3/admin/names\x12W\n" +
|
||||
"\fLoginRefresh\x12\x18.admin.AdminEmptyRequest\x1a\x0f.admin.Response\"\x1c\x82\xd3\xe4\x93\x02\x16:\x01*\"\x11/admin/v3/refresh\x12I\n" +
|
||||
"\x05Login\x12\x13.admin.LoginRequest\x1a\x0f.admin.Response\"\x1a\x82\xd3\xe4\x93\x02\x14:\x01*\"\x0f/admin/v3/login\x12Q\n" +
|
||||
"\tLoginInfo\x12\x18.admin.AdminEmptyRequest\x1a\x0f.admin.Response\"\x19\x82\xd3\xe4\x93\x02\x13:\x01*\"\x0e/admin/v3/info\x12Y\n" +
|
||||
"\tLoginInfo\x12\x18.admin.AdminEmptyRequest\x1a\x0f.admin.Response\"\x19\x82\xd3\xe4\x93\x02\x13:\x01*\x12\x0e/admin/v3/info\x12Y\n" +
|
||||
"\n" +
|
||||
"LoginItems\x12\x18.admin.AdminEmptyRequest\x1a\x0f.admin.Response\" \x82\xd3\xe4\x93\x02\x1a:\x01*\"\x15/admin/v3/login/items\x12`\n" +
|
||||
"LoginItems\x12\x18.admin.AdminEmptyRequest\x1a\x0f.admin.Response\" \x82\xd3\xe4\x93\x02\x1a:\x01*\x12\x15/admin/v3/login/items\x12`\n" +
|
||||
"\x0eLoginKickedOut\x12\x1c.admin.LoginKickedOutRequest\x1a\x0f.admin.Response\"\x1f\x82\xd3\xe4\x93\x02\x19:\x01*\"\x14/admin/v3/kicked-out\x12P\n" +
|
||||
"\x06LogOut\x12\x18.admin.AdminEmptyRequest\x1a\x0f.admin.Response\"\x1b\x82\xd3\xe4\x93\x02\x15:\x01*\"\x10/admin/v3/logout\x12Q\n" +
|
||||
"\vLoginRoutes\x12\x14.admin.RoutesRequest\x1a\x0f.admin.Response\"\x1b\x82\xd3\xe4\x93\x02\x15:\x01*\x12\x10/admin/v3/routes\x12U\n" +
|
||||
@@ -1605,62 +1607,64 @@ var file_proto_admin_proto_depIdxs = []int32{
|
||||
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.LoginRefresh:input_type -> admin.AdminEmptyRequest
|
||||
7, // 7: admin.Admin.Login:input_type -> admin.LoginRequest
|
||||
8, // 8: admin.Admin.LoginInfo:input_type -> admin.AdminEmptyRequest
|
||||
8, // 9: admin.Admin.LoginItems:input_type -> admin.AdminEmptyRequest
|
||||
10, // 10: admin.Admin.LoginKickedOut:input_type -> admin.LoginKickedOutRequest
|
||||
8, // 11: admin.Admin.LogOut:input_type -> admin.AdminEmptyRequest
|
||||
17, // 12: admin.Admin.LoginRoutes:input_type -> admin.RoutesRequest
|
||||
9, // 13: admin.Admin.ServiceInfo:input_type -> admin.InfoRequest
|
||||
11, // 14: admin.Admin.ServiceEdit:input_type -> admin.ServiceEditRequest
|
||||
12, // 15: admin.Admin.ServiceItems:input_type -> admin.ServiceItemsRequest
|
||||
1, // 16: admin.Admin.ServiceStatus:input_type -> admin.StatusRequest
|
||||
13, // 17: admin.Admin.ServiceNames:input_type -> admin.ServiceNameRequest
|
||||
9, // 18: admin.Admin.AuthorityInfo:input_type -> admin.InfoRequest
|
||||
18, // 19: admin.Admin.AuthorityEdit:input_type -> admin.AuthorityEditRequest
|
||||
16, // 20: admin.Admin.AuthorityItems:input_type -> admin.AuthorityItemsRequest
|
||||
1, // 21: admin.Admin.AuthorityStatus:input_type -> admin.StatusRequest
|
||||
15, // 22: admin.Admin.AuthorityNames:input_type -> admin.AuthorityNameRequest
|
||||
14, // 23: admin.Admin.AuthoritySort:input_type -> admin.AuthoritySortRequest
|
||||
20, // 24: admin.Admin.RoleNames:input_type -> admin.RoleNameRequest
|
||||
9, // 25: admin.Admin.RoleInfo:input_type -> admin.InfoRequest
|
||||
21, // 26: admin.Admin.RoleEdit:input_type -> admin.RoleEditRequest
|
||||
22, // 27: admin.Admin.RoleItems:input_type -> admin.RoleItemsRequest
|
||||
1, // 28: admin.Admin.RoleStatus:input_type -> admin.StatusRequest
|
||||
19, // 29: admin.Admin.RoleRule:input_type -> admin.RoleRuleRequest
|
||||
2, // 30: admin.Admin.AdminEdit:output_type -> admin.Response
|
||||
2, // 31: admin.Admin.AdminStatus:output_type -> admin.Response
|
||||
2, // 32: admin.Admin.Password:output_type -> admin.Response
|
||||
2, // 33: admin.Admin.OwnPassword:output_type -> admin.Response
|
||||
2, // 34: admin.Admin.AdminInfo:output_type -> admin.Response
|
||||
2, // 35: admin.Admin.AdminItems:output_type -> admin.Response
|
||||
2, // 36: admin.Admin.LoginRefresh:output_type -> admin.Response
|
||||
2, // 37: admin.Admin.Login:output_type -> admin.Response
|
||||
2, // 38: admin.Admin.LoginInfo:output_type -> admin.Response
|
||||
2, // 39: admin.Admin.LoginItems:output_type -> admin.Response
|
||||
2, // 40: admin.Admin.LoginKickedOut:output_type -> admin.Response
|
||||
2, // 41: admin.Admin.LogOut:output_type -> admin.Response
|
||||
2, // 42: admin.Admin.LoginRoutes:output_type -> admin.Response
|
||||
2, // 43: admin.Admin.ServiceInfo:output_type -> admin.Response
|
||||
2, // 44: admin.Admin.ServiceEdit:output_type -> admin.Response
|
||||
2, // 45: admin.Admin.ServiceItems:output_type -> admin.Response
|
||||
2, // 46: admin.Admin.ServiceStatus:output_type -> admin.Response
|
||||
2, // 47: admin.Admin.ServiceNames:output_type -> admin.Response
|
||||
2, // 48: admin.Admin.AuthorityInfo:output_type -> admin.Response
|
||||
2, // 49: admin.Admin.AuthorityEdit:output_type -> admin.Response
|
||||
2, // 50: admin.Admin.AuthorityItems:output_type -> admin.Response
|
||||
2, // 51: admin.Admin.AuthorityStatus:output_type -> admin.Response
|
||||
2, // 52: admin.Admin.AuthorityNames:output_type -> admin.Response
|
||||
2, // 53: admin.Admin.AuthoritySort:output_type -> admin.Response
|
||||
2, // 54: admin.Admin.RoleNames:output_type -> admin.Response
|
||||
2, // 55: admin.Admin.RoleInfo:output_type -> admin.Response
|
||||
2, // 56: admin.Admin.RoleEdit:output_type -> admin.Response
|
||||
2, // 57: admin.Admin.RoleItems:output_type -> admin.Response
|
||||
2, // 58: admin.Admin.RoleStatus:output_type -> admin.Response
|
||||
2, // 59: admin.Admin.RoleRule:output_type -> admin.Response
|
||||
30, // [30:60] is the sub-list for method output_type
|
||||
0, // [0:30] is the sub-list for method input_type
|
||||
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
|
||||
|
||||
@@ -25,6 +25,7 @@ const (
|
||||
Admin_OwnPassword_FullMethodName = "/admin.Admin/OwnPassword"
|
||||
Admin_AdminInfo_FullMethodName = "/admin.Admin/AdminInfo"
|
||||
Admin_AdminItems_FullMethodName = "/admin.Admin/AdminItems"
|
||||
Admin_AdminNames_FullMethodName = "/admin.Admin/AdminNames"
|
||||
Admin_LoginRefresh_FullMethodName = "/admin.Admin/LoginRefresh"
|
||||
Admin_Login_FullMethodName = "/admin.Admin/Login"
|
||||
Admin_LoginInfo_FullMethodName = "/admin.Admin/LoginInfo"
|
||||
@@ -61,6 +62,7 @@ type AdminClient interface {
|
||||
OwnPassword(ctx context.Context, in *OwnPasswordRequest, opts ...grpc.CallOption) (*Response, error)
|
||||
AdminInfo(ctx context.Context, in *AdminInfoRequest, opts ...grpc.CallOption) (*Response, error)
|
||||
AdminItems(ctx context.Context, in *AdminItemsRequest, opts ...grpc.CallOption) (*Response, error)
|
||||
AdminNames(ctx context.Context, in *AdminEmptyRequest, opts ...grpc.CallOption) (*Response, error)
|
||||
LoginRefresh(ctx context.Context, in *AdminEmptyRequest, opts ...grpc.CallOption) (*Response, error)
|
||||
Login(ctx context.Context, in *LoginRequest, opts ...grpc.CallOption) (*Response, error)
|
||||
LoginInfo(ctx context.Context, in *AdminEmptyRequest, opts ...grpc.CallOption) (*Response, error)
|
||||
@@ -155,6 +157,16 @@ func (c *adminClient) AdminItems(ctx context.Context, in *AdminItemsRequest, opt
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *adminClient) AdminNames(ctx context.Context, in *AdminEmptyRequest, opts ...grpc.CallOption) (*Response, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(Response)
|
||||
err := c.cc.Invoke(ctx, Admin_AdminNames_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *adminClient) LoginRefresh(ctx context.Context, in *AdminEmptyRequest, opts ...grpc.CallOption) (*Response, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(Response)
|
||||
@@ -405,6 +417,7 @@ type AdminServer interface {
|
||||
OwnPassword(context.Context, *OwnPasswordRequest) (*Response, error)
|
||||
AdminInfo(context.Context, *AdminInfoRequest) (*Response, error)
|
||||
AdminItems(context.Context, *AdminItemsRequest) (*Response, error)
|
||||
AdminNames(context.Context, *AdminEmptyRequest) (*Response, error)
|
||||
LoginRefresh(context.Context, *AdminEmptyRequest) (*Response, error)
|
||||
Login(context.Context, *LoginRequest) (*Response, error)
|
||||
LoginInfo(context.Context, *AdminEmptyRequest) (*Response, error)
|
||||
@@ -457,6 +470,9 @@ func (UnimplementedAdminServer) AdminInfo(context.Context, *AdminInfoRequest) (*
|
||||
func (UnimplementedAdminServer) AdminItems(context.Context, *AdminItemsRequest) (*Response, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method AdminItems not implemented")
|
||||
}
|
||||
func (UnimplementedAdminServer) AdminNames(context.Context, *AdminEmptyRequest) (*Response, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method AdminNames not implemented")
|
||||
}
|
||||
func (UnimplementedAdminServer) LoginRefresh(context.Context, *AdminEmptyRequest) (*Response, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method LoginRefresh not implemented")
|
||||
}
|
||||
@@ -658,6 +674,24 @@ func _Admin_AdminItems_Handler(srv interface{}, ctx context.Context, dec func(in
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Admin_AdminNames_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(AdminEmptyRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(AdminServer).AdminNames(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Admin_AdminNames_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(AdminServer).AdminNames(ctx, req.(*AdminEmptyRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Admin_LoginRefresh_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(AdminEmptyRequest)
|
||||
if err := dec(in); err != nil {
|
||||
@@ -1121,6 +1155,10 @@ var Admin_ServiceDesc = grpc.ServiceDesc{
|
||||
MethodName: "AdminItems",
|
||||
Handler: _Admin_AdminItems_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "AdminNames",
|
||||
Handler: _Admin_AdminNames_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "LoginRefresh",
|
||||
Handler: _Admin_LoginRefresh_Handler,
|
||||
|
||||
@@ -45,6 +45,7 @@ type (
|
||||
OwnPassword(ctx context.Context, in *OwnPasswordRequest, opts ...grpc.CallOption) (*Response, error)
|
||||
AdminInfo(ctx context.Context, in *AdminInfoRequest, opts ...grpc.CallOption) (*Response, error)
|
||||
AdminItems(ctx context.Context, in *AdminItemsRequest, opts ...grpc.CallOption) (*Response, error)
|
||||
AdminNames(ctx context.Context, in *AdminEmptyRequest, opts ...grpc.CallOption) (*Response, error)
|
||||
LoginRefresh(ctx context.Context, in *AdminEmptyRequest, opts ...grpc.CallOption) (*Response, error)
|
||||
Login(ctx context.Context, in *LoginRequest, opts ...grpc.CallOption) (*Response, error)
|
||||
LoginInfo(ctx context.Context, in *AdminEmptyRequest, opts ...grpc.CallOption) (*Response, error)
|
||||
@@ -112,6 +113,11 @@ func (m *defaultAdmin) AdminItems(ctx context.Context, in *AdminItemsRequest, op
|
||||
return client.AdminItems(ctx, in, opts...)
|
||||
}
|
||||
|
||||
func (m *defaultAdmin) AdminNames(ctx context.Context, in *AdminEmptyRequest, opts ...grpc.CallOption) (*Response, error) {
|
||||
client := admin.NewAdminClient(m.cli.Conn())
|
||||
return client.AdminNames(ctx, in, opts...)
|
||||
}
|
||||
|
||||
func (m *defaultAdmin) LoginRefresh(ctx context.Context, in *AdminEmptyRequest, opts ...grpc.CallOption) (*Response, error) {
|
||||
client := admin.NewAdminClient(m.cli.Conn())
|
||||
return client.LoginRefresh(ctx, in, opts...)
|
||||
|
||||
@@ -84,3 +84,9 @@ type AdminOutInfo struct {
|
||||
Email string `json:"email"`
|
||||
Roles []string `json:"roles"`
|
||||
}
|
||||
|
||||
type AdminNames struct {
|
||||
Id int `gorm:"column:id;type:int(11);primary_key;AUTO_INCREMENT;comment:ID" json:"id"`
|
||||
Name string `gorm:"column:name;type:varchar(30);comment:真实姓名;NOT NULL" json:"name"`
|
||||
Phone string `gorm:"column:phone;type:char(12);comment:电话" json:"phone"`
|
||||
}
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
package logic
|
||||
|
||||
import (
|
||||
"admin/admin"
|
||||
"admin/internal/dao"
|
||||
"admin/internal/model"
|
||||
"admin/internal/svc"
|
||||
"context"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
"pkg.local/modelbase"
|
||||
"pkg.local/utils"
|
||||
)
|
||||
|
||||
type AdminNamesLogic struct {
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
logx.Logger
|
||||
BaseLogic
|
||||
}
|
||||
|
||||
func NewAdminNamesLogic(ctx context.Context, svcCtx *svc.ServiceContext) *AdminNamesLogic {
|
||||
return &AdminNamesLogic{
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
Logger: logx.WithContext(ctx),
|
||||
}
|
||||
}
|
||||
|
||||
func (l *AdminNamesLogic) AdminNames(in *admin.AdminEmptyRequest) (*admin.Response, error) {
|
||||
modelObj := model.AdminModel{}.Init()
|
||||
w := modelbase.Params{
|
||||
Order: "id desc",
|
||||
}
|
||||
var items []dao.AdminNames
|
||||
err := modelObj.Items(w, &items)
|
||||
if err != nil {
|
||||
l.Logger.Error(err)
|
||||
return l.fail(utils.Fail)
|
||||
}
|
||||
|
||||
for item := range items {
|
||||
mobile, dErr := utils.DecryptPhone(items[item].Phone)
|
||||
if dErr == nil {
|
||||
items[item].Phone = mobile
|
||||
}
|
||||
}
|
||||
|
||||
return l.ok(items)
|
||||
}
|
||||
@@ -53,6 +53,11 @@ func (s *AdminServer) AdminItems(ctx context.Context, in *admin.AdminItemsReques
|
||||
return l.AdminItems(in)
|
||||
}
|
||||
|
||||
func (s *AdminServer) AdminNames(ctx context.Context, in *admin.AdminEmptyRequest) (*admin.Response, error) {
|
||||
l := logic.NewAdminNamesLogic(ctx, s.svcCtx)
|
||||
return l.AdminNames(in)
|
||||
}
|
||||
|
||||
func (s *AdminServer) LoginRefresh(ctx context.Context, in *admin.AdminEmptyRequest) (*admin.Response, error) {
|
||||
l := logic.NewLoginRefreshLogic(ctx, s.svcCtx)
|
||||
return l.LoginRefresh(in)
|
||||
|
||||
@@ -182,6 +182,12 @@ service Admin {
|
||||
body: "*"
|
||||
};
|
||||
};
|
||||
rpc AdminNames(AdminEmptyRequest) returns(Response){
|
||||
option (google.api.http) = {
|
||||
get: "/admin/v3/admin/names"
|
||||
body: "*"
|
||||
};
|
||||
};
|
||||
rpc LoginRefresh(AdminEmptyRequest) returns(Response){
|
||||
option (google.api.http) = {
|
||||
post: "/admin/v3/refresh"
|
||||
@@ -196,13 +202,13 @@ service Admin {
|
||||
};
|
||||
rpc LoginInfo(AdminEmptyRequest) returns(Response){
|
||||
option (google.api.http) = {
|
||||
post: "/admin/v3/info"
|
||||
get: "/admin/v3/info"
|
||||
body: "*"
|
||||
};
|
||||
};
|
||||
rpc LoginItems(AdminEmptyRequest) returns(Response){
|
||||
option (google.api.http) = {
|
||||
post: "/admin/v3/login/items"
|
||||
get: "/admin/v3/login/items"
|
||||
body: "*"
|
||||
};
|
||||
};
|
||||
|
||||
Binary file not shown.
@@ -0,0 +1,2 @@
|
||||
etc/admin.yaml
|
||||
run.toml
|
||||
@@ -0,0 +1,7 @@
|
||||
package config
|
||||
|
||||
import "github.com/zeromicro/go-zero/zrpc"
|
||||
|
||||
type Config struct {
|
||||
zrpc.RpcServerConf
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package dao
|
||||
|
||||
const (
|
||||
LogActionTypeAdd = 1 //增加
|
||||
LogActionTypeEdit = 2 //编辑
|
||||
LogActionTypeDel = 3 //删除
|
||||
LogActionTypeOut = 4 //强退
|
||||
LogActionTypeDown = 5 //下载
|
||||
LogActionTypeStatus = 6 //状态
|
||||
LogActionTypePassword = 7 //修改密码
|
||||
|
||||
//增加、删除、修改时需要改 services.log中的返回值
|
||||
|
||||
LogActionModuleAdmin = "管理员管理"
|
||||
LogActionModuleRole = "角色管理"
|
||||
LogActionModuleService = "服务管理"
|
||||
LogActionModuleAuthority = "权限管理"
|
||||
LogActionModuleProduct = "产品管理"
|
||||
LogActionModuleUser = "用户管理"
|
||||
LogActionModuleOrder = "订单管理"
|
||||
LogActionModuleSale = "销售管理"
|
||||
LogActionModuleTask = "提成与任务管理"
|
||||
LogActionModuleAccount = "结算管理"
|
||||
LogActionModulePay = "支付管理"
|
||||
LogActionModuleStore = "服务商管理"
|
||||
LogActionModuleExpress = "快递管理"
|
||||
LogActionModuleEquipment = "设备管理"
|
||||
LogActionModuleAd = "广告管理"
|
||||
LogActionModuleCustomService = "客服管理"
|
||||
LogActionModuleWorkWeChat = "企业微信管理"
|
||||
LogActionModuleOther = "其他管理"
|
||||
LogActionModulePrison = "监狱管理"
|
||||
LogActionModuleThirdParty = "第三方管理"
|
||||
LogActionModuleBill = "票据管理"
|
||||
LogActionModuleWarehouse = "仓库管理"
|
||||
LogActionModuleBuy = "采购管理"
|
||||
LogActionModuleLog = "日志管理"
|
||||
LogActionModuleFactory = "工厂管理"
|
||||
)
|
||||
Reference in New Issue
Block a user