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.

47 lines
1.1 KiB
Go

package user_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 GetUserAdminLogic struct {
ctx context.Context
svcCtx *svc.ServiceContext
r *http.Request
}
func NewGetUserAdminLogic(r *http.Request, ctx context.Context, svcCtx *svc.ServiceContext) *GetUserAdminLogic {
return &GetUserAdminLogic{
r: r,
ctx: ctx,
svcCtx: svcCtx,
}
}
func (l *GetUserAdminLogic) GetUserAdmin(req *types.UserReq) (resp *types.UserInfo, err error) {
rpcResp, err := l.svcCtx.CoreRpc.GetUser(l.ctx, &core.UserReq{
ID: req.ID,
Username: req.Username,
PhoneNumber: req.PhoneNumber,
Email: req.Email,
WithRole: false,
WithSocial: false,
WithDepartment: false,
WithToken: false,
WithLoginRecord: true,
Page: l.svcCtx.Convert.ConvertPaginationRpc(req.Pagination),
})
if err != nil {
return nil, err
}
resp = l.svcCtx.Convert.ConvertUser(l.ctx, rpcResp)
return
}