[用户]实现对平台用户的增删改查

This commit is contained in:
GoEdgeLab
2020-12-04 16:00:55 +08:00
parent 9e3dc3d2d2
commit 000b5c79e3
19 changed files with 681 additions and 3 deletions

View File

@@ -0,0 +1,25 @@
package userutils
import (
"errors"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
"github.com/iwind/TeaGo/maps"
)
// 查找用户基本信息
func InitUser(p *actionutils.ParentAction, userId int64) error {
resp, err := p.RPC().UserRPC().FindEnabledUser(p.AdminContext(), &pb.FindEnabledUserRequest{UserId: userId})
if err != nil {
return err
}
if resp.User == nil {
return errors.New("not found user")
}
p.Data["user"] = maps.Map{
"id": userId,
"fullname": resp.User.Fullname,
"username": resp.User.Username,
}
return nil
}