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.
38 lines
808 B
Go
38 lines
808 B
Go
1 year ago
|
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 UpdateUserAdminLogic struct {
|
||
|
ctx context.Context
|
||
|
svcCtx *svc.ServiceContext
|
||
|
r *http.Request
|
||
|
}
|
||
|
|
||
|
func NewUpdateUserAdminLogic(r *http.Request, ctx context.Context, svcCtx *svc.ServiceContext) *UpdateUserAdminLogic {
|
||
|
return &UpdateUserAdminLogic{
|
||
|
r: r,
|
||
|
ctx: ctx,
|
||
|
svcCtx: svcCtx,
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func (l *UpdateUserAdminLogic) UpdateUserAdmin(req *types.UserInfo) error {
|
||
|
_, err := l.svcCtx.CoreRpc.UpdateUser(l.ctx, &core.UserInfo{
|
||
|
ID: req.ID,
|
||
|
Nickname: req.Nickname,
|
||
|
Metas: req.Metas,
|
||
|
})
|
||
|
if err != nil {
|
||
|
return err
|
||
|
}
|
||
|
return nil
|
||
|
}
|