feat: rbac迁移完成,并已部署至dev服务器

This commit is contained in:
Blizzard
2026-05-01 01:19:50 +08:00
parent f80a3dc064
commit 8b11068fef
250 changed files with 6314 additions and 13072 deletions
@@ -0,0 +1,31 @@
package user
import (
"context"
"sundynix-micro-go/app/system/api/internal/svc"
"sundynix-micro-go/app/system/api/internal/types"
"sundynix-micro-go/app/system/rpc/system"
"github.com/zeromicro/go-zero/core/logx"
)
type CreateUserLogic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewCreateUserLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreateUserLogic {
return &CreateUserLogic{Logger: logx.WithContext(ctx), ctx: ctx, svcCtx: svcCtx}
}
func (l *CreateUserLogic) CreateUser(req *types.UserCreateReq) error {
_, err := l.svcCtx.SystemRpc.CreateUser(l.ctx, &system.CreateUserReq{
Name: req.Name,
Account: req.Account,
Password: req.Password,
Phone: req.Phone,
})
return err
}
@@ -0,0 +1,26 @@
package user
import (
"context"
"sundynix-micro-go/app/system/api/internal/svc"
"sundynix-micro-go/app/system/api/internal/types"
"sundynix-micro-go/app/system/rpc/system"
"github.com/zeromicro/go-zero/core/logx"
)
type DeleteUserLogic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewDeleteUserLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DeleteUserLogic {
return &DeleteUserLogic{Logger: logx.WithContext(ctx), ctx: ctx, svcCtx: svcCtx}
}
func (l *DeleteUserLogic) DeleteUser(req *types.IdsReq) error {
_, err := l.svcCtx.SystemRpc.DeleteUser(l.ctx, &system.DeleteUserReq{Ids: req.Ids})
return err
}
@@ -0,0 +1,46 @@
package user
import (
"context"
"sundynix-micro-go/app/system/api/internal/svc"
"sundynix-micro-go/app/system/api/internal/types"
"sundynix-micro-go/app/system/rpc/system"
"github.com/zeromicro/go-zero/core/logx"
)
type GetUserListLogic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewGetUserListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetUserListLogic {
return &GetUserListLogic{Logger: logx.WithContext(ctx), ctx: ctx, svcCtx: svcCtx}
}
func (l *GetUserListLogic) GetUserList(req *types.UserListReq) (resp interface{}, err error) {
rpcResp, err := l.svcCtx.SystemRpc.GetUserList(l.ctx, &system.GetUserListReq{
Current: int32(req.Current),
PageSize: int32(req.PageSize),
Name: req.Name,
Account: req.Account,
})
if err != nil {
return nil, err
}
var list []map[string]interface{}
for _, u := range rpcResp.List {
list = append(list, map[string]interface{}{
"id": u.Id,
"name": u.Name,
"account": u.Account,
"nickName": u.NickName,
"phone": u.Phone,
"gender": u.Gender,
"createdAt": u.CreatedAt,
})
}
return map[string]interface{}{"list": list, "total": rpcResp.Total}, nil
}
@@ -0,0 +1,29 @@
package user
import (
"context"
"sundynix-micro-go/app/system/api/internal/svc"
"sundynix-micro-go/app/system/api/internal/types"
"sundynix-micro-go/app/system/rpc/system"
"github.com/zeromicro/go-zero/core/logx"
)
type ResetPasswordLogic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewResetPasswordLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ResetPasswordLogic {
return &ResetPasswordLogic{Logger: logx.WithContext(ctx), ctx: ctx, svcCtx: svcCtx}
}
func (l *ResetPasswordLogic) ResetPassword(req *types.ResetPasswordReq) error {
_, err := l.svcCtx.SystemRpc.ResetPassword(l.ctx, &system.ResetPasswordReq{
Id: req.Id,
Password: req.Password,
})
return err
}
@@ -0,0 +1,32 @@
package user
import (
"context"
"sundynix-micro-go/app/system/api/internal/svc"
"sundynix-micro-go/app/system/api/internal/types"
"sundynix-micro-go/app/system/rpc/system"
"github.com/zeromicro/go-zero/core/logx"
)
type UpdateUserLogic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewUpdateUserLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UpdateUserLogic {
return &UpdateUserLogic{Logger: logx.WithContext(ctx), ctx: ctx, svcCtx: svcCtx}
}
func (l *UpdateUserLogic) UpdateUser(req *types.UserUpdateReq) error {
_, err := l.svcCtx.SystemRpc.UpdateUser(l.ctx, &system.UpdateUserReq{
Id: req.Id,
Name: req.Name,
Account: req.Account,
Phone: req.Phone,
NickName: req.NickName,
})
return err
}