You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
905 B
Go
42 lines
905 B
Go
1 year ago
|
package role_admin
|
||
|
|
||
|
import (
|
||
|
"context"
|
||
|
"git.noahlan.cn/n-admin/n-admin-server/rpc/core/types/core"
|
||
|
|
||
|
"git.noahlan.cn/n-admin/n-admin-server/api/internal/svc"
|
||
|
"git.noahlan.cn/n-admin/n-admin-server/api/internal/types"
|
||
|
|
||
|
"net/http"
|
||
|
)
|
||
|
|
||
|
type GetRoleAdminLogic struct {
|
||
|
ctx context.Context
|
||
|
svcCtx *svc.ServiceContext
|
||
|
r *http.Request
|
||
|
}
|
||
|
|
||
|
func NewGetRoleAdminLogic(r *http.Request, ctx context.Context, svcCtx *svc.ServiceContext) *GetRoleAdminLogic {
|
||
|
return &GetRoleAdminLogic{
|
||
|
r: r,
|
||
|
ctx: ctx,
|
||
|
svcCtx: svcCtx,
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func (l *GetRoleAdminLogic) GetRoleAdmin(req *types.RoleReq) (resp *types.RoleInfo, err error) {
|
||
|
rpcResp, err := l.svcCtx.CoreRpc.GetRole(l.ctx, &core.RoleReq{
|
||
|
ID: req.ID,
|
||
|
Name: req.Name,
|
||
|
Code: req.Code,
|
||
|
WithUser: false,
|
||
|
Page: nil,
|
||
|
})
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
|
||
|
resp = l.svcCtx.Convert.ConvertRole(l.ctx, rpcResp)
|
||
|
return
|
||
|
}
|